首页 > 其他 > 详细

[Decode error - output not utf-8] lua 使用string.sub

时间:2015-03-10 16:42:54      阅读:442      评论:0      收藏:0      [点我收藏+]

对已知中文字符串进行分割,以“(”和“)”来截取字符串;

str1="白雪皑皑雪橇行,胡子老人把人惊(落花无声)";
print(str1);
num1 = string.find(str1,)
num2 = string.find(str1,)
print(num1,":",num2);
print(string.sub(str1,num1,num2))

运行输出;

[Decode error - output not utf-8]

在网上搜有关 not utf-8的很多;但仔细看看好像是分割的字符串不是整个的汉字;

因为 ,一个汉字字符占两个字节,所以是由于sub的下标要估计好了。

[Decode error - output not utf-8] lua 使用string.sub

原文:http://www.cnblogs.com/asheCoder/p/4326156.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!