I’m working with a project that uses the CPack NSIS generator. I would like to display the “registered trademark” (®) symbol in the installer text, but I haven’t been able to make it work. I added the character directly to CPACK_NSIS_PACKAGE_NAME but it appears garbled in the installer text.
AFAICT the symbol is UTF-16 and NSIS would accept it, but since CMake requires UTF-8 files I can’t use UTF-16 characters in CPACK_NSIS_PACKAGE_NAME
Symbols aren’t “UTF-8” or “UTF-16”. UTF-8 and UTF-16 are just different encodings of Unicode. Any Unicode character can be expressed in both UTF-8 and UTF-16.
How exactly have you added the character? Can you verify in a hex editor that the file which includes it represents it as the two bytes 0xC2 0xAE (which is the UTF-8 encoding of “®”)?
I inserted the character using the Sublime Text Unicode Insert addon, it shows up as “bla ®”
In the installer the ® is shown after an additional character, see attached screenshot below.
Using a Hex viewer, it does seem that the character is saved as 0xC2 0xAE and the same seems to be true for the produced project.nsi. So maybe this is a NSIS issue after all?
I enter the string in the CMake file (CMakeLists.txt), then run cmake which I understand will generate the NSIS file and run NSIS to create the package.
I saved the project.nsi produced by CPack (?) as UTF-16 LE with BOM and ran NSIS manually, and the character was shown correctly. It would seem that the issue is that CPack produces an UTF-8 encoded file but NSIS would need UTF-16 at least for this kind of special characters.
Thanks for the suggestion! If I’m reading the tags correctly, the Unicode fix will be in Cmake 3.20 which is not yet released, and because of constraints in the environment I work with I can’t update to that version. What would be the way to add “Unicode true” to CMakeLists.txt so that it propagates to the .nis file?