简体   繁体   中英

NSIS installer creates directory using wrong character set

On some machines my NSIS installer creates folder with one wrong character.

The NSIS was supposed to create a folder with ń char

// U+0144   ń   c5 84   LATIN SMALL LETTER N WITH ACUTE

but instead created a folder with ñ char

// U+00F1   ñ   c3 b1   LATIN SMALL LETTER N WITH TILDE

The wired part is that happens only on some machines and I could not reproduce that. As far as I can tell this was reported only for Windows Vista (possibly basic edition).

I suspect that this has something to do with Windows-1250 to UTF conversion. Because NSIS still does not support UTF, I'm using Windows-1250 encoded script file. The ń char is 0xF1 and should be translated to UTF U+c584 , but instead the installer creates folder with U+c3b1 char. On the other hand the U+c3b1 is equivalent of Windows-1252 0xF1 .

What may affect the interpretation of characters used in NSIS script, when compiled installer runs? How to assure expected conversion 0xF1 => U+c584 ?

The encoding of the NSIS source script does not really decide the final string, the translation of bytes from the script/installer to a unicode string happens on the end users system, therefore characters outside ASCII can vary based on the systems default codepage ( Language for non-Unicode programs (System Locale) ).

You can try to create a custom LangString for this directory name. For this to work you have to set your editors codepage to the problematic codepage when typing the ń. You can probably emulate this by checking $LANGUAGE (or use System::Call kernel32::GetACP()i.r0 and check $0) in .onInit and StrCpy a string that translates correctly on this system into the problematic variable.

The next NSIS version will probably be v3.0, I don't know where you got 2.50 from but it is probably just a placeholder used by the unicode fork.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM