VASmalltalk – CodePages – Part II

Ok, more or less VA is not really able to retrieve the current code page. They seem to go via the selected font, retrieve the char set of that font and get something like ISO8859-1 and via some strange stuff they actually get ibm-819 and this is pretty correct, but the fonts within Windows are not only ISO8859-1, but contain some additional characters …..

Here another code example how to get the active code page of your windows system (I have translated it from stackoverflow):

| langID buffer SORT_DEFAULT |

buffer := OSInt8 new: 10.
langID := (PlatformFunctions::GetKeyboardLayout callWith: 0) bitAnd: 16rFFFF.
  callWith: (langID + ( SORT_DEFAULT bitShift: 16))
  with: PlatformConstants::LocaleIdefaultansicodepage
  with: buffer
  with: 10.
(String copyFromOSMemory: buffer) asNumber 

which returns 1252.

by the way: the ibm-code page name for win-1252 is “ibm-5348_P100-1997” …. under ICU you get it via

UConverter defaultConverter converterName
This entry was posted in Smalltalk and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s