I think you guyz are looking at the wrong place, the script file encoding has nothing to do with it
et2010 wrote:And when I check the output.txt with Notepad.exe, it has UTF-8 encoding and the unicode string is showing correctly:
So the output was UTF-8 ! ( you've read a UTF-8 value and output it to a UTF-8 file )
et2010 wrote:OK, I got a way to reproduce this issue, here is the script:
Code: Select all
UTF8Str = 中文
tooltip, %UTF8Str%
sleep, 5000
return
save the script in UTF-8 (without BOM) and run.
Hard coding the symbols in a UTF-8 script file and sending it to a unicode output is sure to fail ( tooltip is produced by unicode AutoHotkey.exe in a Windows unicode control )
If you want to test, you should read the value from a unicode environment like the clipboard.
So, known facts: you're reading a UTF-8 value from outside the script and you want to Output that value as unicode ...
The script file encoding has nothing to do with that, everything is happening in memory, the value is never written to that file.
I don't know how ... but you must read that UTF-8 value, translate it to unicode then output it!