Wednesday, October 24, 2012

Testing Unicode

If your windows GUI app isn't built with the unicode define then it depends on the ACP registry setting. When you paste characters into text boxes, they may be silently converted to best-fit characters. Here's some good examples.

   Unicode   Utf8  cp437   cp850    cp1252    cp950     cp737   cp1253     Name                 Letter
₧  20A7    e282a7  yes     ?        n/a       ?         n/a     ?          PESETA SIGN          no
ž  017E      c5be  n/a     ?        yes       ?         n/a     ?          Z WITH CARON         yes
η  03B7      ceb7  n/a     ?        n/a       ?         yes     ?          LETTER ETA           yes
×  00D7      c397  n/a     yes      yes       ?         n/a     ?          MULTIPLICATION SIGN  no
Ë  00CB      c38b  n/a     ALT+211  ALT+0203  n/a       n/a     n/a        E WITH DIAERESIS     yes
à 00C3      c383  n/a     ALT+199  ALT+0195  n/a       n/a     n/a        A WITH TILDE         yes
µ  00B5      c2b5  ALT+230 ALT+230  ALT+0181  n/a       n/a     ALT+0181   MICRO SIGN           no
μ  03BC      cebc  n/a     n/a      n/a       ALT+41831 ALT+163 ALT+0236   LETTER MU            yes
§  00A7      c2a7  n/a     ALT+245  ALT+0167  ALT+41393 n/a     ALT+0167   SECTION SIGN         no
Π  03A0      cea0  ?       ?        n/a       ?         ?       ALT+0208   LETTER PI            yes
π  03C0      cf80  ?       ?        n/a       ?         ?       ALT+0240   SMALL LETTER PI      yes

This string is 21 characters and 32 bytes long.

₧ ž η × Ë Ã µ μ § Π π

For reference, here's the registry settings you get for different OS locales.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage\ACP = 950
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage\OEMCP = 950

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage\ACP = 1252
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage\OEMCP = 850

US English
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage\ACP = 1252
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage\OEMCP = 437

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage\ACP = 1253
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage\OEMCP = 737
{ "loggedin": false, "owner": false, "avatar": "", "render": "nothing", "trackingID": "UA-36983794-1", "description": "", "page": { "blogIds": [ 248 ] }, "domain": "", "base": "\/michael", "url": "https:\/\/\/michael\/", "frameworkFiles": "https:\/\/\/michael\/_framework\/_files.4\/", "commonFiles": "https:\/\/\/michael\/_common\/_files.3\/", "mediaFiles": "https:\/\/\/michael\/media\/_files.3\/", "tmdbUrl": "http:\/\/\/", "tmdbPoster": "http:\/\/\/t\/p\/w342" }