Unfortunately, PSPad is not an open source, so I have forced to tell you how to
make it yourself. ;-)

Just walk programmatically on _HKEY_CLASSES_ROOT\Mime\Database\Codepage_
key and enumerate it's subkeys - these names are appropriate codepage values.
For each subkey you can read the _Description_ value - this string can be
added to codepages menu. When needed for suitable HTML encoding, read the
_WebCharset_ value, if exists, otherwise the _BodyCharset_ value.

Reverse conversion is possible via help of neighbor
_HKEY_CLASSES_ROOT\Mime\Database\Charset_ key. ;-)

IMHO, these registry entires are used by IE. Windows supports all the codepages
natively, via _MultiByteToWideChar_/_WideCharToMultiByte_ functions.
For example, code _20866_ results Cyrillic KOI8-R conversion, not elsewhere
provided by the system (I don't know, at least :) ).

And, please, don't use of
_OemToChar_/_OemToCharBuff_/_CharToOem_/_CharToOemBuff_
working with Unicode characters - they cause problems like
this (viz http://forum.pspad.com/read.php?2,39760 ) or
that (viz http://forum.pspad.com/read.php?4,23202,42646#msg-42646 ).

IMHO, use of descripted registry database can solve all of encode/codepages
problems once and for all.

-- 
<http://forum.pspad.com/read.php?2,46867,46867>
PSPad freeware editor http://www.pspad.com

Odpovedet emailem