In the Java language, the following questions about character set encoding (Character set encoding) and internationalization (i18n), which are correct?
A. Each Chinese character occupies 2 bytes, and each English character occupies 1 bytes
B. Assuming that the characters in the database are GBK encoded, the Web page that displays the database data must also be GBK encoded.
The char type of C.java, which usually holds a character in the form of UTF-16 Big endian.
D. The most common means of achieving international application is to use the ResourceBundle class
Answer: CD
Analytical:
A is obviously wrong, Java is all Unicode encoded, and each character occupies 2 bytes in both Chinese and English characters. Java's class file is encoded as UTF-8, and the virtual machine JVM is encoded as UTF-16UTF-8 encoding, a Chinese account of 3 bytes, an English account of 1 byte B is also incorrect, different encodings can be converted, The usual process is to decompose the string s in its own encoding into a byte array, and then recode the byte array into a string in the encoding you want to output. Example: String newutf8str = new String (Oldgbkstr.getbytes ("GBK"), "UTF8"); C is correct. It is also correct to save a character D in a Java virtual machine, usually using the UTF-16 method. ResourceBundle is able to selectively read the properties file corresponding to the local suffix according to local, in order to achieve the internationalization goal. In summary, the answer is C and D.
Questions about the Java Character set encoding