#include #include main(args) { local cs; local mappable; local s; local b; /* test some simple US-ASCII mappings */ cs = new CharacterSet('us-ascii'); "us-ascii:\n"; "\texists? <>\n"; "\tcan map 0x77? <>\n"; "\tcan map 'abc'? <>\n"; "\tcan map 0x10CD? <>\n"; "\tcan map 'abc\u1011\u1012def'? << cs.isMappable('abc\u1011\u1012def') ? 'yes' : 'no'>>\n"; "\b"; /* test local character set operations */ "Local display character set = <>\n"; "Local file system character set = <>\n"; "\b"; /* test for the local presence of the Cyrillic alphabet */ cs = new CharacterSet(getLocalCharSet(CharsetDisplay)); "Can the local display character set show the Cyrillic alphabet? "; for (mappable = 'yes', local ch = 0x0410 ; ch <= 0x044F ; ++ch) { if (!cs.isMappable(ch)) { mappable = 'no'; break; } } "<>\b"; /* iso-8859-1 - unicode to local */ cs = new CharacterSet('iso-8859-1'); "Some ISO 8859-1 mappings: unicode to local:\n"; s = 'test \x91\x92\u1024 done'; b = s.mapToByteArray(cs); "'<>' -> "; for (local i = 1 ; i <= b.length() ; ++i) "[<>]=<>\t"; "\b"; /* iso8859-1 - local to unicode */ "ISO 8859-1: local to unicode\n"; for (local i = 1 ; i <= b.length() ; ++i) b[i] = 64 + i; "'<>'\b"; }