/** * Korean & Japanese Encoding Tables * * Provides character mapping support for: * - EUC-KR (Korean) - KS X 1001/1003 encoding * - Shift-JIS (Japanese) - JIS X 0201/0208 encoding * - ISO-2022-JP (Japanese) - JIS encoding with escape sequences * * Note: For full coverage, these use TextEncoder/TextDecoder as the primary * implementation since they provide native support in modern environments. * The mapping tables here serve as reference and fallback. */ /** * KS X 1001 (Hangul) code range in EUC-KR: * First byte: 0xB0-0xC8 (128-200) * Second byte: 0xA1-0xFE (161-254) * * KS X 1003 (Hanja) code range in EUC-KR: * First byte: 0xCA-0xFD * Second byte: 0xA1-0xFE */ export declare const HANGUL_SYLLABLE_OFFSET = 44032; export declare const HANGUL_INITIAL_COUNT = 21; export declare const HANGUL_MEDIAL_COUNT = 21; export declare const HANGUL_FINAL_COUNT = 28; /** * JIS X 0201 (Half-width Katakana): * First byte: 0xA1-0xDF (single-byte) * * JIS X 0208 (Kanji): * First byte: 0x81-0x9F (low) or 0xE0-0xEF (high) * Second byte: 0x40-0x7E (low) or 0x80-0xFC (high) * * JIS X 0212 (Supplementary Kanji): * First byte: 0xE0-0xEA * Second byte: 0x40-0x7E or 0x80-0xFC */ export declare const SHIFT_JIS_KATAKANA_START = 161; export declare const SHIFT_JIS_KATAKANA_END = 223; export declare const SHIFT_JIS_KANJI_LOW_START = 129; export declare const SHIFT_JIS_KANJI_LOW_END = 159; export declare const SHIFT_JIS_KANJI_HIGH_START = 224; export declare const SHIFT_JIS_KANJI_HIGH_END = 239; export declare const SHIFT_JIS_KANJI_SECOND_MIN = 64; export declare const SHIFT_JIS_KANJI_SECOND_MAX = 252; /** * Check if a Unicode code point is a Korean Hangul syllable */ export declare function isKoreanHangul(code: number): boolean; /** * Check if a Unicode code point is a Korean Hanja (Hanja) */ export declare function isKoreanHanja(code: number): boolean; /** * Check if a Unicode code point is basic Korean (Hangul Jamo) */ export declare function isKoreanJamo(code: number): boolean; /** * Check if a code point is Japanese Hiragana */ export declare function isJapaneseHiragana(code: number): boolean; /** * Check if a code point is Japanese Katakana (full-width) */ export declare function isJapaneseKatakana(code: number): boolean; /** * Check if a code point is Japanese Kanji (CJK Unified Ideographs in Japanese range) */ export declare function isJapaneseKanji(code: number): boolean; /** * Encode a Hangul syllable to EUC-KR bytes * * Hangul syllables in Unicode are algorithmically decomposable: * 1. Syllable = 0xAC00 + (initial × 21 + medial) × 28 + final * 2. We decompose to lead, vowel, trail * 3. Then convert to EUC-KR lead/trail bytes */ export declare function encodeHangulSyllable(code: number): [number, number] | null; /** * Convert Unicode Hiragana to Shift-JIS * U+3040-309F → 0x829F-0x82F1 (simplified mapping) */ export declare function unicodeToShiftJisHiragana(code: number): [number, number] | null; /** * Convert Unicode Katakana to Shift-JIS * U+30A0-30FF → 0x8340-0x8396 (full-width Katakana) */ export declare function unicodeToShiftJisKatakana(code: number): [number, number] | null; /** * Convert half-width Katakana to Shift-JIS * U+FF61-U+FF9F → 0xA1-0xDF */ export declare function unicodeToHalfWidthKatakana(code: number): number | null; /** * Check if a code point is in JIS X 0208 range and estimate its Shift-JIS position * This is a simplified heuristic - full conversion requires large tables */ export declare function isInJisX0208Range(code: number): boolean; /** * ISO-2022-JP (JIS X 4081) escape sequences: * - ESC ( B - ASCII * - ESC ( J - JIS X 0201 Roman * - ESC $ B - JIS X 0208 * - ESC $ @ - JIS X 0208:1983 (old) * - ESC $ D - JIS X 0208:1990 (new) * - ESC $ ( C - JIS X 0212 supplementary */ /** * ISO-2022-JP escape sequences */ export declare const ISO2022JP_ESC_ASCII: Uint8Array; export declare const ISO2022JP_ESC_JIS0201: Uint8Array; export declare const ISO2022JP_ESC_JIS0208: Uint8Array; export declare const ISO2022JP_ESC_JIS0208_83: Uint8Array; export declare const ISO2022JP_ESC_JIS0208_90: Uint8Array; /** * ISO-2022-JP text encoder state */ export type ISO2022JPState = 'ASCII' | 'JIS0208' | 'JIS0201'; /** * Check if a code point requires JIS X 0208 escape sequence */ export declare function requiresJisX0208Escape(code: number): boolean; /** * Check if a code point is JIS X 0201 Katakana (half-width) */ export declare function isJisX0201Katakana(code: number): boolean;