const
CP_UTF8 = 65001;
{ ... }
var
FileName: string;
S: string;
begin
FileName := 'test.txt';
if not LoadStringFromFileInCP(FileName, S, CP_UTF8) then
begin
Log('Error loading the file');
end
else
if StringChangeEx(S, 'žluťoučký kůň', 'ďábelské ódy', True) <= 0 then
begin
Log('No value was replaced');
end
else
if not SaveStringToFileInCP(FileName, S, CP_UTF8) then
begin
Log('Error writing the file');
end
else
begin
Log('Replacement successful');
end;
end;
LoadStringFromFileInCP
和SaveStringToFileInCP
:从何而来
转换阵列字符串为Unicode和回ANSI - Inno Setup的
该代码需要Inno Setup的Unicode版本(Inno Setup 6唯一的版本)。
对于Unicode字符串文字,您的.iss
文件必须采用带有BOM的UTF-8编码。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句