Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specifying non-ASCII characters for NSIS' LangString

Tags:

nsis

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 ö?

like image 861
Paul J. Lucas Avatar asked Nov 10 '10 03:11

Paul J. Lucas


3 Answers

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

like image 146
Paul J. Lucas Avatar answered Oct 20 '22 06:10

Paul J. Lucas


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.

like image 26
Anders Avatar answered Oct 20 '22 08:10

Anders


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
like image 1
Andry Avatar answered Oct 20 '22 07:10

Andry