0
我正在使用NSIS Unicode版本我試圖將字符串追加到現有的Unicode文件(UTF-16LE)。將字符串寫入Unicode文件
我的問題:當我將字符串寫入文件然後打開文件,我寫的字符串就是亂碼。我有一種感覺,它試圖將ANSI字符串寫入UTF-16LE文件。
如何寫一個字符串到一個unicode文件?
Function ${prefix}AppendFile
# Note: Will automatically create file if it doesn't exist
# $0 = fName
# $1 = strToWrite
Pop $1
Pop $0
ClearErrors
FileOpen $3 $0 a
FileSeek $3 0 END
FileWrite $3 "$\r$\n" # write a new line
FileWrite $3 "$1"
FileWrite $3 "$\r$\n" # write an extra line
FileClose $3 # close the file
IfErrors 0 +2
MessageBox MB_OK "Append Error: $1 $\r$\n$\r$\n$0"
FunctionEnd