Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Inno Setup's ExpandConstant support UTF-8?

Tags:

inno-setup

I have an Inno Setup installer that creates custom wizard pages using Pascal Script. The installer appears to use the proper patterns for supporting other languages. However, the custom wizard pages, created with CreateCustomPage(), show garbage characters in them, instead of the strings in the target language (which in this case, is Russian.)

The strings are stored in a [CustomMessages] section, using include files for each language. Though I'm a newbie with Inno Setup, the strings do appear to be set up in a manner that is consistent with the Inno Setup examples, and with instructions I've read from various sources on the internet.

Anyway, the custom wizard pages and the controls on them are created using code such as:

Page := CreateCustomPage(
  PreviousPageId,
  ExpandConstant('{cm:MyStringConstant}'),
  ExpandConstant('{cm:MyOtherStringConstant}')
);

Then, in the strings include file (again, for Russian), the strings are defined as:

[CustomMessages]
ru.MyStringConstant=<Russian string>
ru.MyOtherStringConstant=<Russian string>

But when the installer runs, the strings on the custom wizard pages appear with garbage characters (as if the UTF-8 characters are being interpreted as Ansi), rather than in the proper Russian text.

The other pages in the installer (ie, those not created with CreateCustomPage()) appear correctly.

So, my question is, does something special need to be done when using ExpandConstant() with UTF-8 strings? Or is there a better function to use to retrieve UTF-8 strings from the [CustomMessages] section?

like image 867
piccy Avatar asked Oct 06 '22 03:10

piccy


1 Answers

As long as you're running the unicode version of the Inno Compiler, then UTF-8 is supported in the main ISS file. You CAN NOT use UTF-8 or any unicode format in the ISL language files as these must be in ANSI with the appropriate codepage specified.

You must also use unicode character literals to specify unicode text in the [Code] section.

See the Unicode Inno Setup article in the help file for details.

like image 190
Deanna Avatar answered Oct 10 '22 01:10

Deanna