- Back to Home »
- 楓之谷教學 »
- 【楓之谷教學】GMS V62小馬端寵物中文名修復 作者:宗達
首先至GenericLittleEndianWriter.java
取代為
接著在適當位置加入
LittleEndianWriter.java
在適當位置加入
MaplePacketCreator.java 找到 (有2段要改)
改為
最後則是到 db.properties
將 url=jdbc:mysql://localhost:3306/pony
改為 url=jdbc:mysql://localhost:3306/pony?characterEncoding=UTF8
來使資料庫使用中文編碼
[Java] syntaxhighlighter_viewsource syntaxhighlighter_copycode
01
02
03
04
05
06
07
08
09
10
11
12
13
| public int getlength(String str) { int i, t = 0; byte[] bt = str.getBytes(); for (i = 1; i <= bt.length; i++) { if (bt[i - 1] < 0) { t = t + 2; i++; } else { t = t + 1; } } return t;} |
取代為
[Java] syntaxhighlighter_viewsource syntaxhighlighter_copycode
01
02
03
04
| public static final int getlength(final String str) { byte[] bt = str.getBytes(ASCII); return bt.length;} |
接著在適當位置加入
[Java] syntaxhighlighter_viewsource syntaxhighlighter_copycode
01
02
03
04
05
06
07
08
09
10
| @Overridepublic void writeAsciiString(String s, int length) { if (getlength(s) > length) { s = s.substring(0, length); } write(s.getBytes(ASCII)); for (int i = getlength(s); i < length; i++) { write(0); }} |
LittleEndianWriter.java
在適當位置加入
[Java] syntaxhighlighter_viewsource syntaxhighlighter_copycode
01
| public void writeAsciiString(String s, int length); |
MaplePacketCreator.java 找到 (有2段要改)
[Java] syntaxhighlighter_viewsource syntaxhighlighter_copycode
01
02
03
04
05
06
07
| if (petname.length() > 13) { petname = petname.substring(0, 13); } mplew.writeAsciiString(petname); for (int i = petname.length(); i < 13; i++) { mplew.write(0); } |
改為
[Java] syntaxhighlighter_viewsource syntaxhighlighter_copycode
01
| mplew.writeAsciiString(petname, 13); |
最後則是到 db.properties
將 url=jdbc:mysql://localhost:3306/pony
改為 url=jdbc:mysql://localhost:3306/pony?characterEncoding=UTF8
來使資料庫使用中文編碼
作者:宗達
原文:點此
