Inno Setup Unicode版仍然无法正确显示Cyrillic

时间:2013-08-19 08:44:54

标签: unicode inno-setup

我正在使用Inno Setup 5.5.2(u),除了TStringList中动态填充的字符串外,所有符号都很好。我初始化列表并以这种方式添加项目:

Regions := TStringList.Create;
Regions.Add('Аврен');
Regions.Add('Айтос');
Regions.Add('Аксаково');
Regions.Add('Алфатар');
...

但我得到了:

enter image description here

感谢您对此进行调查。

1 个答案:

答案 0 :(得分:4)

目前,您无法在Inno Setup中使用Unicode常量。在documentation中有关于它的引用(我强调):

  

Unicode编译器使用的新RemObjects PascalScript版本   支持Unicode,但不支持其输入源。这意味着它确实使用了   如上所述的Unicode字符串类型,但是中的任何文字Unicode字符   该脚本将转换为ANSI

     

这并不意味着您无法显示Unicode字符串:您可以   例如,使用编码的Unicode字符来构建Unicode   字符串(如S:=#$ 0100 +#$ 0101 +'Aa';),或从a加载字符串   使用LoadStringsFromFile文件,或使用{cm:...}常量。

因此,根据其中的内容,您可以按以下格式编码这些常量字符:

[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program

[Code]
procedure InitializeWizard;
var
  Regions: TStringList;
  ComboBox: TComboBox;
  CustomPage: TWizardPage;
begin
  CustomPage := CreateCustomPage(wpWelcome, 'Caption', 'Description');
  ComboBox := TComboBox.Create(WizardForm);
  ComboBox.Parent := CustomPage.Surface;

  Regions := TStringList.Create;
  try
    Regions.Add(#$0410 + #$0432 + #$0440 + #$0435 + #$043D
    Regions.Add(#$0410 + #$0439 + #$0442 + #$043E + #$0441
    Regions.Add(#$0410 + #$043A + #$0441 + #$0430 + #$043A + #$043E + #$0432 + #$043E
    Regions.Add(#$0410 + #$043B + #$0444 + #$0430 + #$0442 + #$0430 + #$0440
    ComboBox.Items.AddStrings(Regions);
  finally
    Regions.Free;
  end;
end;

或者您可以通过建议的LoadStringsFromFile函数从外部文件加载区域列表,并使用输出数组填充字符串列表(或直接填充组合框)。

或者您可以制作外部custom messages文件。