Filter UTF16 converting to ISO-2022-CN/KR or HZ
Peter Edberg <[email protected]> Tue, 30 Nov 2004 16:02:32 -0800
| Newsgroups | gmane.comp.lib.icu.general |
|---|---|
| Message-ID | <a06002000bdd2b7eb9e24@[10.0.0.5]> |
I have been investigating using ICU converters for "ISO-2022-KR", "ISO-2022-CN" and "HZ-GB-2312" to replace some of our Mac OS algorithmic converters. I noticed when using ucnv_fromUnicode with these converters that they do not filter UTF16 values which will be invalid or misleading in the ISO-2022 or HZ output. For example, given UTF16 input 0061 000E 0062 0063, the ISO-2022-KR/CN converters produce (after initial G1-designation escape sequence) 61 0E 62 63. The presence of the 0x0E (shift out) will cause the subsequent 62 63 to be misinterpreted as GB2312 or KSC5601 text instead of ASCII. It seems to me that the Unicode 000E should either be ignored or be replaced in the ISO-2022 output by a fallback or substitution character. I plan to file a jitterbug, but first I would like to solicit input on what others feel is the appropriate way to handle this sort of situation. Thanks, Peter -- ---------------------------------------------- Peter Edberg . . . . Apple Computer, Inc. Mac OS Engineering: International & Text Group Tel: +1 (408) 974-4275, Fax: +1 (408) 862-4566 ----------------------------------------------