带汉字字符串循环出错

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: 带汉字字符串循环出错

Re: 带汉字字符串循环出错

by ma0575 » 17 Mar 2021, 03:30

感谢两位回复 但正如我原文描述 我几种编码都尝试过 没有任何效果(毕竟逻辑非常简单
整体字符串直接 Msgbox 是可以正常显示 共123 这个字符串的,表现上不是编码问题

另外重装电脑前 没有任何变动的脚本是正常的,把脚本拷贝到其他电脑也是正常运行的…… 所以想看看有没有什么思路解决


今天又花时间尝试了下 确实是编码问题 此贴完结
具体之前排查出错的原因 电脑里 ahk文件的打开方式中有一个名称ahk unicode 32的条目实际指向的是ahk ansi32, 不清楚这个奇葩问题怎么产生的

Re: 带汉字字符串循环出错

by sikongshan » 17 Mar 2021, 02:18

是的,基本上还是脚本编码问题
可以尝试吧文件编码选择为:带 BOM 的 UTF-8

带汉字字符串循环出错

by ma0575 » 16 Mar 2021, 07:40

最近重装了电脑,然后出现了一个奇怪的问题 带汉字的字符串循环都不能正常识别汉字
比如

Code: Select all

addressA=共123
Loop,parse,addressA
{
 Msgbox,%A_LoopField%
}
期待结果: --> 共 1 2 3
实际结果: --> ? ? 1 2 3
汉字没有被正确识别,字符串长度打出来也是识别为5
ansi文本+ a32.exe执行 以及 utf-8文本 + u32.exe执行 均是同样的结果, 咨询下有没有什么解决方案 非常感谢

windows版本 企业版LTSC 1809(17763.316) ahk版本 最新版的1.1.33.06

Top