简体   繁体   中英

UTF-8 encoding in NSIS version info

I have this simple UTF-8 script

Unicode true

VIProductVersion "0.0.0.1"
VIAddVersionKey "ProductName" "Test"
VIAddVersionKey "FileVersion" "0.0.0.1"
VIAddVersionKey "FileDescription" "Test installer"
VIAddVersionKey "LegalCopyright" "Me © 2022"

Section
SectionEnd

The issue is with the © character. After compilation with NSIS 3.08, the copyright info ends up in the installer resources as Me \xC2\xA9 2022

在此处输入图像描述

It seems that the source is transformed into UTF-16 byte by byte, rather than character by character. Is there a way how I can ensure proper UTF-16 encoding of that character? I can probably always use (c) instead, but I'm wondering if there's some other way (except using UTF-16 for the whole script)

Unicode true specifies that you want to generate a Unicode installer but it does not change the interpretation of the.nsi file itself (however, it will change the default of.included files).

If the MakeNSIS output includes a line that looks like Processing script file: "C:\Users\Anders\test.nsi" (ACP) then that means the compiler is using the default codepage for ANSI programs when it is parsing your.nsi (for compatibility with NSIS v2).

There are several ways to fix this:

  • Manually specify the Unicode character codepoint: "Me ${U+A9} 2022" .
  • Make sure your.nsi file has a BOM so it is parsed as UTF-8.
  • Compile as MakeNSIS /INPUTCHARSET UTF8 MyFile.nsi

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