IBM 1141 seems to be already part of Windows NT starting with Windows 2000 at least. Just ask system administrator to install it via Control Panel / Windows Components.
http://msdn.microsoft.com/en-us/library/windows/desktop/dd317756.aspx
Then, depending on your Delphi version you can
- use TEncoding class
- use
AnsiString
wich specified codepage (assign UnicodeString aka string
from it) and/or use SetCodePage
procedure
- use Win32 API
MultiByteToWideChar
to convert PAnsiChar
to UTF-16, then convert it back to 1252
- using libraries like
Jedi CodeLib
that have readymade wrapper, doing the #3 flip-flop in one call.
Notice, please, that you should not expect ALL the characters to be mapped between those charsets. Some rare characters like control codes and diacritics may be present only in one of the charsets, and be missed from its counterpart. WideCharToMultiByte
function mentions this specifically.
Alternative approaches (not necessary successful) may include:
- Aforementioned
JCL.sf.net
has it's own JclUnicode unit, that may have it's own built-in map instead of relying on Windows-provided map. I don't remember if IBM1141
is included or not though.
IBM Classes for Unicode
may include those codepages as well (or may not, but probably they would). Has anyone used ICU with Delphi?
iconv
library started on UNIX systems, but with porting of IDEs like CodeTyphon
/Lazarus
back to Windows they should have libiconv
ported to Windows (probably as part of MSYS
project) and contain Pascal headers for it. Try installing downloading CodeTyphon and see if you can re-use its libiconv
units in Delphi.