Archive: Code page detection on taget computer


Code page detection on taget computer
How can you detect which code page is used by target computer?

I'm making an installer that is using SerbianLatin language file, and it works fine if target computer has nonUnicode language set to Serbian. My problem is that most computers in my country are set to use English for nonUnicode and that makes my <č ć ž š đ> appear as <è æ ž š ð>.
Now I can live with <c c ž š dj> (corrections I made manually to language files) until NSIS goes Unicode, but to make that I need to detect codepage of target computer and use SerbianLatin <č ć ž š đ> or SerbianLatinModified <c c ž š dj>.
I'm guessing it goes into onInit function (before anything appears on screen) but don't know how to implement it.


Use GetACP.

System::Call kernel32::GetACP()i.r0
${If} $0 == somecodepage
StrCpy $LANGUAGE ${LANG_SOMETHING}
${ElseIf} $0 == someothercodepage
StrCpy $LANGUAGE ${LANG_SOMETHINGELSE}
${Else}
StrCpy $LANGUAGE ${LANG_DEFAULT}
${EndIf}

It works

Thanks kichik