如果文字档案编码不是utf-8而是其他的话读取除了英文之外其他的会变乱码
比较实际的例子,本来端裡有个脚本是纯英文的,如果用记事本打开,输入中文存档后游戏裡面显示乱码
在端源内打开EncodingDetect.java并将其丢进tools资料夹里
改3個文件
3個文件都要在頭部適當位置加入如下代码
01.import tools.EncodingDetect;
scripting/AbstractScriptManager.java 73行的BufferedReader bf = new BufferedReader(new InputStreamReader(in, "utf-8"));改成BufferedReader bf = new BufferedReader(new InputStreamReader(in, EncodingDetect.getJavaEncode(scriptFile)));
scripting/PortalScriptManager.java 73行的BufferedReader bf = new BufferedReader(new InputStreamReader(in, "utf-8")); 改成BufferedReader bf = new BufferedReader(new InputStreamReader(in, EncodingDetect.getJavaEncode(scriptFile)));
server/ServerProperties.java 47行的BufferedReader bf = new BufferedReader(new InputStreamReader(in, "utf-8"));
改成BufferedReader bf = new BufferedReader(new InputStreamReader(in, EncodingDetect.getJavaEncode(path)));
本文来源于心动冒险岛(www.leyoucx.com),如需转载[以正确编码来读取服务端配置与脚本的方法],请写明出处
上一篇:关于我对反伤的理解