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
How can I internationalize the Yes/No/Cancel buttons in a JOptionPane?
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
How can I store and retrieve Unicode or Double Byte data in a database using JDBC?
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
How do I set a default character encoding for file I/O operations, JDBC requests and so on?
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
How can I store and retrieve Unicode or Double Byte data in a file using the java.io libraries?
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
How can I reload ResourceBundles?
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
How do I use a ResourceBundle?
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
What is a ResourceBundle and what it is used for?
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
How can I get the number of days that have elapsed between two Date objects?
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
What is Unicode?
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
What happened to printf or how do I format the numbers I need to print?
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
Why is Internationalization sometimes called I18N?
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