如下图
下面是另一个问题
此外,除了msg.fromMsg,此问题还出现在getUserConf(msg.fromQQ, “name”),其他未测试,可能也有问题
--判断连续的三位byte是否符合汉字规范
--第一位应该介于[228,233],第二位和第三位应该介于[128,191]
s_byte=""
flag=false
for i=1,string.len(msg.fromMsg)-2 do
s_byte = s_byte..string.byte(msg.fromMsg,i)..","
local ss1 = string.byte(msg.fromMsg,i)
local ss2 = string.byte(msg.fromMsg,i+1)
local ss3 = string.byte(msg.fromMsg,i+2)
if (228<=ss1 and ss1<=233 and 128<=ss2 and ss2<=191 and 128<=ss3 and ss3<=191) then
flag = true
end
end
s_byte = s_byte..string.byte(msg.fromMsg,-2)..","
s_byte = s_byte..string.byte(msg.fromMsg,-1)..","
if (flag) then
return "【检测到汉字】\n接收到字符:"..msg.fromMsg.."\n字符byte为"..s_byte
else
return "【未检测到汉字】\n接收到字符:"..msg.fromMsg.."\n字符byte为"..s_byte
end