Class TransliteratingASCIIProvider

java.lang.Object
java.nio.charset.spi.CharsetProvider
com.maybeitssquid.safeascii.TransliteratingASCIIProvider

public class TransliteratingASCIIProvider extends CharsetProvider
A CharsetProvider that supplies ASCII-safe character sets for encoding Unicode text. This provider offers five distinct character set implementations:
X-ASCII-Printable (alias: ASCII-Printable)
Strict printable ASCII: allows 0x20 through 0x7E inclusive. Control characters, including tabs and newlines, are reported as unmappable.
X-ASCII-Plain (alias: ASCII-Plain)
Printable ASCII with newline support: linefeed (0x0A) passes through; carriage return (0x0D) is unmappable so CRLF normalises to LF under the IGNORE error action. All other control characters are unmappable.
X-ASCII-Formatted (alias: ASCII-Formatted)
Printable ASCII with tab and newline support: tab (0x09) and linefeed (0x0A) pass through; carriage return (0x0D) is unmappable so CRLF normalises to LF under the IGNORE error action. All other control characters are unmappable.
X-Transliterating
Aggressive Unicode-to-ASCII transliteration using NFKD decomposition and character-name lookup. Output length may vary (one Unicode character may produce multiple ASCII bytes).
X-Transliterating-Single-Byte (alias: ACH)
Same transliteration as X-Transliterating but guarantees 1:1 character output. Any transliteration that would produce more or fewer than one character is rejected as unmappable.
  • Field Details

  • Constructor Details

    • TransliteratingASCIIProvider

      public TransliteratingASCIIProvider()
      Creates a new TransliteratingASCIIProvider instance.

      This provider will lazily initialize the available character sets upon the first request.

  • Method Details