Java will store your chinese into Unicode# Java - 爪哇娇娃
a*r
1 楼
if you just use
String ChnStr = "中文字符串";
in the java source file, in the system, I mean after the compile, the storage format for that ChnStr is alreay in the Unicode
encoding, rather than the GB2312 or what ever. Bec, the java specification just implicitly declares that all kinds of string
constructed in the source code will be in the Unicode.
That means, you could still use getBytes() to convert that string to a byte
array containing the GB2312 code, then, you concantenate them into a string
String ChnStr = "中文字符串";
in the java source file, in the system, I mean after the compile, the storage format for that ChnStr is alreay in the Unicode
encoding, rather than the GB2312 or what ever. Bec, the java specification just implicitly declares that all kinds of string
constructed in the source code will be in the Unicode.
That means, you could still use getBytes() to convert that string to a byte
array containing the GB2312 code, then, you concantenate them into a string