Skip to content
⌘ NSIS Forum Archive

Bad Text Encoding Error with special characters in NSIS 3.09 version

8 posts

Ujjwal59#

Bad Text Encoding Error with special characters in NSIS 3.09 version

My Product was using NSIS 3.04 version and everything was working fine now I have upgraded NSIS version to 3.09 and the files which has special character for example : © copyright symbol or any other files which has different language include like Spanish or Chinese in all it is throwing Bad text encoding error . like one of the file below where the same error is coming

Bad text encoding: es.nsh:5
!include: error in script: "es.nsh" on line 5
Error in macro MUI_LANGUAGE on macroline 1
Error in script "dsLUSetup.nsi" on line 36 -- aborting creation process​


File es.nsh has the data
;--------------------------------
!insertmacro MUI_LANGUAGEFILE_STRING LANGUAGE "ES"
!insertmacro MUI_LANGUAGEFILE_LANGSTRING LANGUAGE MUI_TEXT_UNSUPPORT_OS "Test no es compatible con esta plataforma. Se anulará el proceso de instalación."​


Please help me to solve this problem
Ujjwal59#
Open the file in notepad++ , in encoding tab convert ANSI to UTF-8-BOM and compiled again but still seen the same error:

Bad text encoding: es.nsh:5
!include: error in script: "es.nsh" on line 5
Error in macro MUI_LANGUAGE on macroline 1
Error in script "dsLUSetup.nsi" on line 36 -- aborting creation process​

Please correct me If i am doing something wrong here
Anders#
Are you running makensis on Windows or Posix?

Attach the problematic nsh and I'll take a look...
Ujjwal59#
Yes in windows
I have added both the files dsLUSetup.nsi" which is internal calling es.nsh and failing , Please check
Anders#
Your es.nsh file does not have a UTF-8 BOM/signature. Even if I interpret it as UTF-8, there is something wrong with it (assuming Mongolian letter Oe (U+1825) is not something one would use in Spanish). The last character, U+EEBA2 is the invalid? codepoint that causes the compiler to abort.

In your Hex editor, the file should start with EF BB BF.
Ujjwal59#
Thanks for your response, but what about other files like korean, chinese, japanese when i try to convert UTF-8-BOM they still give the same error (Bad text encoding) Like one sample file attached

Attachments

Anders#
Originally Posted by Ujjwal59 View Post
what about other files like korean, chinese, japanese when i try to convert UTF-8-BOM they still give the same error (Bad text encoding) Like one sample file attached
That file is also missing the UTF-8 BOM. Whatever you are doing in your editor is not correct. Please verify with a hex editor.

It works just fine with a proper BOM. If you can't get it to work, try UTF-16 LE BOM instead, your editor might do that properly.

Look at my ko.nsh in your hex editor to see the BOM...