Search found 18 matches

by et2010
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...
by et2010
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
by et2010
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...
by et2010
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

you're missing the %%s to deref the tooltip var. but yes, it fails for me with no BOM. and WITH BOM, it works.
Thanks for the heads up.
guest3456 wrote:maybe something like:

AutoHotKey.exe /CP65001 test.ahk {output}
I didn't know that option, thanks
but it still doesn't work.
by et2010
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?
by et2010
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
by et2010
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...
by et2010
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:

Code: Select all

UTF8Str = 中文
tooltip, %UTF8Str%
sleep, 5000
return
save the script in UTF-8 (without BOM) and run. You should get something like this:
snipaste20170215_101443.png
snipaste20170215_101443.png (598 Bytes) Viewed 7196 times
by et2010
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.
by et2010
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...
by et2010
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
by et2010
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 ...
by et2010
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
其中 {argument} 是外部程序输出的字串, 为 UTF-8 编码,而 output.txt 的编码也确实是 UTF-8。

这是不是说明 utf-8 编码的字符直接通过参数传递给 ahk 脚本是会导致乱码的。我的 AHK 版本为 1.1.24.02(64位)。
by et2010
14 Feb 2017, 10:02
Forum: 请求帮助
Topic: ahk脚本接收到UTF-8编码的字符串参数时怎样处理?
Replies: 7
Views: 7999

Re: ahk脚本接收到UTF-8编码的字符串参数时怎样处理?

脚本原来保存为 UTF-8,改为 UTF-8 with BOM 后结果一样,都是中文乱码
by et2010
14 Feb 2017, 08:58
Forum: 请求帮助
Topic: ahk脚本接收到UTF-8编码的字符串参数时怎样处理?
Replies: 7
Views: 7999

Re: 运行ahk脚本时接收到中文字符参数是乱码?

再次更正,是因为程序发出的是 UTF-8 编码的字符串,这个字符串作为参数直接传递给 ahk 脚本,然后出现乱码。那么问题变为,怎样使 ahk 脚本正确接收 UTF-8 编码的字符串参数?
by et2010
14 Feb 2017, 06:35
Forum: 请求帮助
Topic: ahk脚本接收到UTF-8编码的字符串参数时怎样处理?
Replies: 7
Views: 7999

Re: 运行ahk脚本时接收到中文字符参数是乱码?

抱歉,是我搞错了,上面的脚本是可以显示中文的。因为是用 ahk 脚本来接收其它程序发送来的数据,而发送来的数据已经是乱码了,所以导致我接收到的也是乱码。

简单来说,问题不是出在 AHK 这边。


问题已经改了,这里关键是参数是 UTF-8 编码的
by et2010
14 Feb 2017, 06:13
Forum: 请求帮助
Topic: ahk脚本接收到UTF-8编码的字符串参数时怎样处理?
Replies: 7
Views: 7999

ahk脚本接收到UTF-8编码的字符串参数时怎样处理?

第一次提问,如有不符合规则还请指出。

运行ahk脚本时可以加参数,比如

Code: Select all

AutoHotKey.exe test.ahk argument
其中的argument如果是 UTF-8 编码的字符串,则以下脚本输出的 Tooltip 中将包含乱码,这个问题怎样解决?

test.ahk脚本内容如下:

Code: Select all

Tooltip, The value of argument 1 is %1%
Sleep, 5000
return
by et2010
26 Jan 2017, 08:12
Forum: 脚本函数
Topic: AHK 进程管理
Replies: 6
Views: 13094

Re: AHK 进程管理

@tmplinshi 感谢你的快速回复,另存为UTF-8(with BOM)后问题已解决。

Go to advanced search