I18N Section Index | Page 7
Why do I get ??? or other dysfunctional characters on my DOS ( or other character ) console for valid Unicode or other non-default encodings?
PrintStream (aka System.out) trims off the high-order byte.
The PropertyResourceBundle class constructor takes an InputStream (not a Reader). Does this mean that the property files that back the PropertyResourceBundle always have to be encoded in ASCII (Cp1252 really on windows)? How are people (localizers) dealing with that in Japan/Korea/China etc.?
According to the book Core Java 1.1, Advanced Features, this is the case. The work around suggested in the book is to use ListResourceBundle instead. According to Sun's Bug Parade, there is a work...more
When reading with a Reader from an ASCII source, how does the Reader know it is ASCII/8-bit instead of Unicode/16-bit data?
Well the Reader really wraps an InputStream which gives byte-level access to the data source. What the Reader (e.g. InputStreamReader) does is to load a correct implementation of sun.io.ByteToCha...more
Depending upon which version of Java you are using, there are different answers. With 1.3, the labels are in properties files. You can add a property file with the labels for a JFileChooser, JCol...more
The underlying DBMS must support Unicode or the desired encoding. Internally, Java data are stored as Unicode only. So, if the Database supports Unicode and the table was created that way, the dat...more
The default encoding used by locale/encoding sensitive API in the Java libraries is determined by the System property "file.encoding". This system property is initialized by the JVM star...more
When using resource bundles (ResourceBundle), how does the system determine which bundle to bind to?
The javadoc for the ResourceBundle class describes the methodology method determining which bundle to use. See http://java.sun.com/products/jdk/1.2/docs/api/java/util/ResourceBundle.html. more
Java supports a number of encodings for use with InputStreamReaders and OutputStreamWriters. By using these classes, it's easy to read and write Unicode or any other supported encodings. Here's ...more
Alas, there is no standard way, currently, to reload ResourceBundles. You can vote for this to be fixed on the JDC Bug Parade (#4212439). more
In order to localize labels, you need to pull them all out and do lookups at runtime. The Java means to do this is through the ResourceBundle class. Resource bundles provide a simple key-value loo...more
A ResourceBundle is like a specialized form of a Hashtable that maps strings to values. That doesn't sound too exciting by itself, but the magic of ResourceBundle allows you to have different look...more
That depends on what you mean by "between". If you want to find out the number of 24-hour periods between two Date objects d1 and d2 (d2 > d1) then you would do this: double days = (d2.getTim...more
Unicode provides a standard encoding for the character sets of different languages. The encoding is independent of the platform, program, or language used to access said data. Visit the Unicode Co...more
The Java libraries and println() method provide no direct equivalent to printf/sprintf. While Acme labs provides an alternative at http://www.acme.com/java/software/Acme.Fmt.html, the NumberFormat...more
Because internationalization is too long to write all the time. There are 20 characters in internationalization. The number of characters between the first and last character is 18. So, if you wri...more