How to save a UTF-16 with BOM file with Inno Setup
问题 How to save a string to a text file with UTF-16 (UCS-2) encoding with BOM? The SaveStringsToUTF8File saves as UTF-8. Using streams saves it as ANSI. var i:integer; begin for i := 1 to length(aString) do begin Stream.write(aString[i],1); Stream.write(#0,1); end; stream.free; end; 回答1: As the Unicode string (in the Unicode version of Inno Setup – the only version as of Inno Setup 6) actually uses the UTF-16 LE encoding, all you need to do is to copy the (Unicode) string to a byte array (