Inno脚本函数“ LoadStringFromFile”无法正确读取Unicode

时间:2018-06-28 16:06:16

标签: unicode inno-setup readfile

我有一个Inno脚本,该脚本从文件夹中读取文本文件“ Version.txt”,并以无线电格式显示内容,如下图所示。问题不是显示:“ Version 1.0”&“ Version 2.0”。它显示了诸如“ yBC”和“ yBC”之类的文本,令人难以理解。如何纠正代码以从文本文件读取unicode格式?

Picture

  if ((FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY) <> 0) and
     (FindRec.Name <> '.') and
     (FindRec.Name <> '..') then
  begin
    Path := RootPath + '\' + FindRec.Name;
    { LoadStringFromFile can handle only ascii/ansi files, no Unicode }
    if LoadStringFromFile(Path + '\' + 'Version.txt', Name) then
    begin
      Dirs.Add(Path);
      DirCheckListBox.AddRadioButton(Name, '', 0, False, True, nil);
      { If already installed, check the path that was selected previously, }
      { otherwise check the first one }
      if (DirCheckListBox.Items.Count = 1) or
         (CompareText(WizardForm.DirEdit.Text, Path) = 0) then
      begin
        DirCheckListBox.ItemIndex := DirCheckListBox.Items.Count - 1;
        DirCheckListBox.Checked[DirCheckListBox.ItemIndex] := True;
      end;
    end;
  end;

0 个答案:

没有答案