中英文字符字节长度判断GB2312(Unity支持GB2312编码的方式)

Encoding.GetEncoding("gb2312").GetBytes(str).Length;

Unity支持GB2312编码的方式

1.在Unity软件目录中搜索:I18N.dll和I18N.CJK.dll。会搜索到多个任意一个都行。 2.把上面搜索到的2个dll文件复制到Asset目录下。 3.OK了。

 

在unity编辑器里面运行没问题,运行build版报“ArgumentException: Encoding name 'gb2312' not supported”,解决如下:

The issue here is that I18N.dll and I18N.West.dll are missing in the standalone player. They are available in the editor, though. That's why it's working in the editor but not in the standalone player.

Solution: Put those DLLs into your project (probably best next to System.Data.dll), that way, they will be also available in the standalone player.

 

NOTE: There's also other I18N ("Internationalization") DLLs available, so if you have trouble with another CodePage, you might have to use one of those in your specific case.

I18N.dll和I18N.CJK.dll

即,将unity安装目录下的两个dll复制到工程文件下,和System.Data.dll同级即可,然后再build。
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值