Search found 18 matches
- 15 Feb 2017, 00:13
- Forum: Ask for Help (v1)
- Topic: Passing UTF-8 strings to AHK script Topic is solved
- Replies: 22
- Views: 8232
Re: Passing UTF-8 strings to AHK script Topic is solved
Thanks. To me, then, this appears to be a Zim issue (while I'm not 100% sure about that, I also don't see why you should have to change your locale - if anything, if that actually is a possible workaround, I'm surprised I'm having no problems with my en _GB locale), as cscript also shows the charac...
- 14 Feb 2017, 22:44
- Forum: Ask for Help (v1)
- Topic: Passing UTF-8 strings to AHK script Topic is solved
- Replies: 22
- Views: 8232
Re: Passing UTF-8 strings to AHK script Topic is solved
Still the same, the Chinese characters not showing correctly here
- 14 Feb 2017, 22:20
- Forum: Ask for Help (v1)
- Topic: Passing UTF-8 strings to AHK script Topic is solved
- Replies: 22
- Views: 8232
Re: Passing UTF-8 strings to AHK script Topic is solved
I use exactly the same command as yours, and my autohotkey is 64bit too. So maybe I should try to switch my locale? Doing so might be a bit drastic. IMHO, if there is a problem, it's likely to be in Zim. What happens if you run test.ahk D:\James\Dropbox\zim\data\Notebooks\Notes\Test_Page_中文 from th...
- 14 Feb 2017, 22:19
- Forum: Ask for Help (v1)
- Topic: Passing UTF-8 strings to AHK script Topic is solved
- Replies: 22
- Views: 8232
Re: Passing UTF-8 strings to AHK script Topic is solved
Thanks for the heads up.you're missing the %%s to deref the tooltip var. but yes, it fails for me with no BOM. and WITH BOM, it works.
I didn't know that option, thanksguest3456 wrote:maybe something like:
AutoHotKey.exe /CP65001 test.ahk {output}
but it still doesn't work.
- 14 Feb 2017, 22:07
- Forum: Ask for Help (v1)
- Topic: Passing UTF-8 strings to AHK script Topic is solved
- Replies: 22
- Views: 8232
Re: Passing UTF-8 strings to AHK script Topic is solved
@qwerty12, thanks very much for your reply.
I use exactly the same command as yours, and my autohotkey is 64bit too. So maybe I should try to switch my locale?
I use exactly the same command as yours, and my autohotkey is 64bit too. So maybe I should try to switch my locale?
- 14 Feb 2017, 21:58
- Forum: Ask for Help (v1)
- Topic: Passing UTF-8 strings to AHK script Topic is solved
- Replies: 22
- Views: 8232
Re: Passing UTF-8 strings to AHK script Topic is solved
@tmplinshi has also reproduced my issue
- 14 Feb 2017, 21:52
- Forum: Ask for Help (v1)
- Topic: Passing UTF-8 strings to AHK script Topic is solved
- Replies: 22
- Views: 8232
Re: Passing UTF-8 strings to AHK script Topic is solved
save the script in UTF-8 ( without BOM ) and run AFAIK, the BOM is required if you want the actual contents of the script to be handled as Unicode: https://autohotkey.com/board/topic/91711-unicode-bom/?p=578486 But, saying that, I'd be surprised if that's actually your issue. Presumably the Chinese...
- 14 Feb 2017, 21:15
- Forum: Ask for Help (v1)
- Topic: Passing UTF-8 strings to AHK script Topic is solved
- Replies: 22
- Views: 8232
Re: Passing UTF-8 strings to AHK script Topic is solved
OK, I got a way to reproduce this issue, here is the script:
save the script in UTF-8 (without BOM) and run. You should get something like this:
Code: Select all
UTF8Str = 中文
tooltip, %UTF8Str%
sleep, 5000
return
- 14 Feb 2017, 19:32
- Forum: Ask for Help (v1)
- Topic: Passing UTF-8 strings to AHK script Topic is solved
- Replies: 22
- Views: 8232
Re: Passing UTF-8 strings to AHK script Topic is solved
To elaborate a bit, that external app I mentioned is actually zim - a desktop wiki software. It has a Custom Tool functionality, and provides several parameters to be passed to your custom command. And in my case, the custom command is an AHK script.
- 14 Feb 2017, 19:08
- Forum: Ask for Help (v1)
- Topic: Passing UTF-8 strings to AHK script Topic is solved
- Replies: 22
- Views: 8232
Re: Passing UTF-8 strings to AHK script Topic is solved
I take you use fileread to read {output}? There is a specific parameter for FileRead (see docs) so you can set the encoding. Sorry I didn't make it clear. I didn't use fileread to read the {output} . And I also assume you've saved your script as UTF-8 (unicode as well) by default your editor may be...
- 14 Feb 2017, 12:49
- Forum: 请求帮助
- Topic: ahk脚本接收到UTF-8编码的字符串参数时怎样处理?
- Replies: 7
- Views: 7999
Re: ahk脚本接收到UTF-8编码的字符串参数时怎样处理?
详情见这里:tmplinshi wrote: 我也不太确定。
最好是能说一下重现方法、提供测试程序。
https://autohotkey.com/boards/viewtopic.php?f=5&t=28134
- 14 Feb 2017, 12:47
- Forum: Ask for Help (v1)
- Topic: Passing UTF-8 strings to AHK script Topic is solved
- Replies: 22
- Views: 8232
Passing UTF-8 strings to AHK script Topic is solved
I got an external app whose output is a UTF-8 string, I can check the {Output} with cmd: cmd /K echo {output} >> output.txt And when I check the output.txt with Notepad.exe, it has UTF-8 encoding and the unicode string is showing correctly: D:\James\Dropbox\zim\data\Notebooks\Notes\Test_Page_中文 But ...
- 14 Feb 2017, 10:09
- Forum: 请求帮助
- Topic: ahk脚本接收到UTF-8编码的字符串参数时怎样处理?
- Replies: 7
- Views: 7999
Re: ahk脚本接收到UTF-8编码的字符串参数时怎样处理?
这是字符串的编解码问题,与脚本的编码应该是没有关系的吧?检查下脚本是否保存为了 UTF-8 (含BOM)
另外如果用 cmd 查看 argument 参数的话,可以用:
Code: Select all
cmd /K echo {argument} >> output.txt
这是不是说明 utf-8 编码的字符直接通过参数传递给 ahk 脚本是会导致乱码的。我的 AHK 版本为 1.1.24.02(64位)。
- 14 Feb 2017, 10:02
- Forum: 请求帮助
- Topic: ahk脚本接收到UTF-8编码的字符串参数时怎样处理?
- Replies: 7
- Views: 7999
Re: ahk脚本接收到UTF-8编码的字符串参数时怎样处理?
脚本原来保存为 UTF-8,改为 UTF-8 with BOM 后结果一样,都是中文乱码
- 14 Feb 2017, 08:58
- Forum: 请求帮助
- Topic: ahk脚本接收到UTF-8编码的字符串参数时怎样处理?
- Replies: 7
- Views: 7999
Re: 运行ahk脚本时接收到中文字符参数是乱码?
再次更正,是因为程序发出的是 UTF-8 编码的字符串,这个字符串作为参数直接传递给 ahk 脚本,然后出现乱码。那么问题变为,怎样使 ahk 脚本正确接收 UTF-8 编码的字符串参数?
- 14 Feb 2017, 06:35
- Forum: 请求帮助
- Topic: ahk脚本接收到UTF-8编码的字符串参数时怎样处理?
- Replies: 7
- Views: 7999
Re: 运行ahk脚本时接收到中文字符参数是乱码?
简单来说,问题不是出在 AHK 这边。
问题已经改了,这里关键是参数是 UTF-8 编码的
- 14 Feb 2017, 06:13
- Forum: 请求帮助
- Topic: ahk脚本接收到UTF-8编码的字符串参数时怎样处理?
- Replies: 7
- Views: 7999
ahk脚本接收到UTF-8编码的字符串参数时怎样处理?
第一次提问,如有不符合规则还请指出。
运行ahk脚本时可以加参数,比如
其中的argument如果是 UTF-8 编码的字符串,则以下脚本输出的 Tooltip 中将包含乱码,这个问题怎样解决?
test.ahk脚本内容如下:
运行ahk脚本时可以加参数,比如
Code: Select all
AutoHotKey.exe test.ahk argument
test.ahk脚本内容如下:
Code: Select all
Tooltip, The value of argument 1 is %1%
Sleep, 5000
return
Re: AHK 进程管理
@tmplinshi 感谢你的快速回复,另存为UTF-8(with BOM)后问题已解决。