Specifying non-ASCII characters for NSIS' LangString
Asked Answered
N

4

10

I'm using NSIS to generate a Windows' installer for my application. I'd like a multi-lingual installer. I'm using LangString for specifying strings.

However, the documentation doesn't seem to say how one should encode a non-ASCII character. For example, to use the German word "benötigt" (where the 'o' has an umlaut), how should I encode the ö?

Neddie answered 10/11, 2010 at 3:28 Comment(0)
N
3

It's just easier to use the Unicode version of NSIS. The entire problem then goes away.

Neddie answered 16/11, 2010 at 23:0 Comment(0)
I
3

If you want to compile the UNICODE strings by the ANSI version of NSIS compiler, then you have to put such strings in separate .nsi file with UCS-2 LE BOM (lookup it with Notepad++) format and directly include that.

I've using particularly english and russian versions of such files at the end of a main.nsi:

!ifdef LANG_ENGLISH
!include "${PROJECT_SRCS_ROOT}\lang_en.nsi"
!endif

!ifdef LANG_RUSSIAN
!include "${PROJECT_SRCS_ROOT}\lang_ru.nsi"
!endif
Interpolate answered 13/9, 2017 at 16:13 Comment(1)
It worked for me. However, the Code in my Notepad++ version was called UTF-16 LE BOM. Worked fine - thank You!Obscurantism
V
2

I assume we are talking about the ANSI version of NSIS here...

The 2nd parameter to LangString is the language id (You can generate one with NSIS\Bin\MakeLangId.exe, but since you probably already use the MUI_LANGUAGE macro or LoadLanguageFile, ${LANG_GERMAN} etc will be defined for you)

NSIS does not really care how the string is encoded, but if you have a lot of strings in different languages, it is probably a good idea to put the LangString commands in external files that you can !include. This way you can edit different language files with different codepages and text editors.

Violetteviolin answered 10/11, 2010 at 11:2 Comment(9)
NSIS has been standardized by ANSI? That aside, how can it not care about the encoding? It has to display the text on-screen. It must assume some encoding. ISO-8859-1? UTF-8? Can the encoding be specified? If so, how?Neddie
No, ANSI like windows 9x is ANSI and not Unicode. NSIS does not display anything, windows does, NSIS just gives it a char*.Violetteviolin
OK, so how do you tell Windows what the character encoding is?Neddie
In the control panel regional options, there is a combobox to set the codepage for ansi programs. The NSIS language selection dialog tries to only display languages that would "work"Violetteviolin
NSIS correctly displays it's own boiler-plate text, but it currently does not display mine correctly. A ü (small letter 'u' with an umlaut) displays as ü (a capital letter 'A' with a tilde followed by a 1/4 fraction). The byte value of the ü is 0xFC. That obviously doesn't work. What value(s) should replace the 0cFC?Neddie
NSIS 3.01 in 2017: despite the Unicode option, it does NOT seem to handle UTF-8 encoded script files with Umlauts (as with OT). It does work with ANSI / ISO 8859-1 encoded script files.Carcinoma
@Carcinoma I'm pretty sure it works but I would need more information. Does the UTF-8 .nsi have a BOM etc? File a bug report on SourceForge or the NSIS forum if you believe there is a problem, I cannot deal with this in comments.Violetteviolin
@Violetteviolin Thanks for your interest: with and without BOM (Notepad++, Atom). Not a real problem since it's fine with ISO 8859-1.Carcinoma
@Carcinoma It is a problem if something is broken but talking about it here is not going to fix anything, post a bug report like I already suggested.Violetteviolin
R
0

if you can not use the unicode version of nsis, you could encode your text in latin-1 (ISO 8859-1) which can be used to produce these umlauts as ü,ä,ö

Rhizopod answered 21/2, 2018 at 15:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.