Archive: Oem <-> Ansi


Oem <-> Ansi
Somebody has a small console program or plugin for converting the text from oem in ansi?


I never did this, but MSDN declares:
The OemToChar function translates a string from the OEM-defined character set into either an ANSI or a wide-character string. (OEM stands for original equipment manufacturer.)

BOOL OemToChar(
LPCSTR lpszSrc, // pointer to string to translate
LPTSTR lpszDst // pointer to buffer for translated string
);

BOOL OemToCharBuff(
LPCSTR lpszSrc, // pointer to string to translate
LPTSTR lpszDst, // pointer to buffer for translated string
DWORD cchDstLength // size of buffer
);

lpszSrc
Pointer to a buffer containing one or more characters from the OEM-defined character set.
lpszDst
Pointer to the buffer for the translated string. If the OemToCharBuff function is being used as an ANSI function, the string can be translated in place by setting the lpszDst parameter to the same address as the lpszSrc parameter. This cannot be done if the OemToCharBuff function is being used as a wide-character function.
cchDstLength
Specifies the number of characters to translate in the buffer identified by the lpszSrc parameter.

Import Library: Use user32.lib.

And I see in the user32.dll
OemToCharA
OemToCharBuffA
OemToCharBuffW
OemToCharW
entry points.


Not sure if this helps, but you might be able to use NSIS's built-in IntFmt command on a character-by-character basis. (It uses the wsprintf function at MSDN at http://msdn.microsoft.com/library/de...s/wsprintf.asp).

I'm just offering this as a possible solution--I've not actually tried it. At least in theory, it looks like it might work...


Thanks guys!

StrCpy $0 `ãá᪨¥ ᨬ¢®«ë`  ;OEM

; OEM2ANSI
System::Call 'user32::OemToChar(t r0, t .r1)'
; $1=`Ðóññêèå ñèìâîëû` ;ANSI

; ANSI2OEM
System::Call 'user32::CharToOem(t r1, t .r2)'
; $2=`ãá᪨¥ ᨬ¢®«ë` ;OEM