Inno Setup Reading file in Ansi and Unicode encoding

前端 未结 1 932
礼貌的吻别
礼貌的吻别 2020-12-10 18:36

I have a function called GetServerName. I need to pass the file name (say for example \'test.txt\') as well as a needed section string (say for example \'server

相关标签:
1条回答
  • 2020-12-10 18:46

    First, note that the Unicode is not an encoding. The Unicode is a character set. Encoding is UTF-8, UTF-16, UTF-32 etc. So we do not know which encoding you actually use.


    In the Unicode version of Inno Setup, the LoadStringsFromFile function uses the current Windows Ansi encoding by default.

    But, if the file has the UTF-8 BOM, it will treat the contents accordingly. The BOM is a common way to autodetect the UTF-8 (and other UTF-*) encoding. You can create a file in the UTF-8 encoding with BOM using Windows Notepad.

    UTF-16 or other encodings are not supported natively.

    For implementation of reading UTF-16 file, see Inno Setup Pascal Script - Reading UTF-16 file.

    0 讨论(0)
提交回复
热议问题