> For the complete documentation index, see [llms.txt](https://tchat.tect.host/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tchat.tect.host/anti-unicode/configuration.md).

# Configuration

## General

```yml
modules:
  # Block Unicode abuse, similar-looking characters, invisible characters, and other Unicode-based chat exploits.
  #
  # Anti unicode module loaded from modules/antiunicode.yml
  anti-unicode: true
```

* modules.anti-unicode: Enable/disable the module

***

## Module

#### Action

```yml
# What to do when a disallowed unicode character is detected:
# - STRIP : Silently remove only the offending characters, keep the rest of the message
# - CENSOR : Replace only the matched characters with censor-char
# - BLOCK : Cancel the message entirely
action: STRIP
```

* STRIP: Removes the unicode characters.
* BLOCK: Cancels the message.
* CENSOR: Replace the uppercase letters with the 'censor-char' character.

#### Censor-char

```yml
# Character used to replace matched letters (only relevant when action: CENSOR)
censor-char: "*"
```

* The censor character for the 'CENSOR' action.

#### Filters

```yaml
filters:

  # Bidirectional control characters (RLO/LRO/PDF/isolates/ALM).
  # These can visually reorder text to disguise its real content ("Trojan Source" style attacks).
  # Strongly recommended to keep this enabled.
  bidi-control: true

  # Zero-width / invisible characters (ZWSP, ZWNJ, ZWJ, word joiner, BOM, soft hyphen,
  # variation selectors...)
  # e.g. "d​i​s​c​o​r​d" with invisible characters between letters.
  zero-width: true

  # Non-printable ASCII control characters (does not affect tab/newline/carriage-return)
  control-chars: true

  # "Zalgo" text, excessive stacked combining diacritical marks
  zalgo: true

  # Fullwidth forms and Mathematical Alphanumeric Symbols
  # (e.g. bold/italic unicode letters)
  fullwidth: true

  # Private Use Area characters, custom icon/font glyphs, sometimes abused for spam or ASCII-art walls
  private-use-area: true

  # Standard emoji ranges. Disabled by default since most servers allow emoji in chat.
  emoji: false

  # Restrict messages to an explicit whitelist of unicode scripts (see 'scripts.allowed' below).
  # Disabled by default, only enable this if you want to block non-Latin alphabets entirely,
  scripts: false
```

* bidi-control: Detects Unicode bidirectional control characters that can visually reorder text while leaving its actual contents unchanged.
* zero-width: Detects invisible formatting characters that cannot normally be seen by players.
* control-chars: Detects non-printable ASCII control characters.
* zalgo: Detects excessive combining diacritical marks ("Zalgo text").
* fullwidth: Detects Fullwidth Forms and Mathematical Alphanumeric Symbols.
* private-use-area: Detects characters from the Unicode Private Use Areas (PUA).
* emoji: Detects Unicode emoji characters.
* scripts: Restricts messages to specific Unicode writing systems (scripts).

#### Zalgo

```yaml
zalgo:
  # Maximum number of stacked combining marks allowed on a single base character before it's flagged
  max-combining-marks: 2
```

* max-combining-marks: Maximum number of consecutive combining marks allowed on a single character before it is considered Zalgo text.

#### Scripts

```yaml
scripts:
  # Only used if filters.scripts: true
  # Valid names: see java.lang.Character.UnicodeScript (e.g. LATIN, CYRILLIC, GREEK, HAN, ARABIC...)
  # https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Character.UnicodeScript.html
  allowed:
    - LATIN
    - COMMON
    - INHERITED
```

* Defines the Unicode scripts that are permitted when the `scripts` filter is enabled.
