import sun.io.*;
public class EncodingCheck
{
public static void main(String args[])
{
System.out.println("System default encoding = "
+ System.getProperty("file.encoding"));
System.out.println("ByteToCharConverter= "
+ ByteToCharConverter.getDefault());
System.out.println("CharToByteConverter= "
+ CharToByteConverter.getDefault());
int i = "XXXXX".length();
System.out.println("System String.length = "
+ i);
}
}
System.setProperty() is defined also, but I have never used it. When coding i18n
(internationalization, 18 chars between first i and last n), be careful about
javac -encoding <encoding> foo.java
As an example, when compiling the above, where XXXXX is your country's multi-byte
character, and the char is hard-coded, javac -encoding is required.
Welcome to the complicated i18n world.
akira kumakiri