I18N Section Index | Page 4
How do we know which charset the OS is using? For example, I know that Japanese Windows 95 encoding is MS932, but how do we know which charset it uses?
There is an undocumented system property ("file.encoding" I think) which gives the name of the default encoding. A better way is to create an OutputStreamWriter without specifiying the e...more
How can I format, parse, and validate telephone numbers according to locale?
You may want to look at the international standard for telephone numbering. This is the ITU (International Telecommunication Union) publication no. E.164, The international public telecommunicatio...more
Is ASCII considered a subset of Unicode, or are they disjoint sets?
ASCII is a subset of Unicode, although it is almost the other way around: the Unicode Standard team intentionally chose to assign the first 256 Unicode characters to match Latin-1. The first 128...more
How do I display and parse a date?
The Java I18N way is to use a DateFormat. While SimpleDateFormat, which is generally returned, creates a large number of objects, it is locale aware and will handle most of your needs. The follo...more
How can I get yesterday's date?
// get Calendar with current date
java.util.GregorianCalendar gCal =
new GregorianCalendar();
// get yesterday's date
gCal.add( Calendar.DATE, -1 );
// get components ...more
What's the difference between java.util.Calendar's add and roll methods?
Calendar.roll changes a specific unit and leaves 'larger' ( in terms of time - month is 'larger' than day) units unchanged. The API example is that given a date of August 31, 1999, rolling by (Ca...more
How can I retrieve string data from a database in Unicode format?
The data is already in Unicode when it arrives in your program. Conversion from and to the encoding/charset/CCSID in the database from/to Unicode in the program is part of the JDBC driver's job.
...more
What version of Java first supported the Euro?
It was Sun's JDK 1.1.7B.
Where can I find out about telephone number formats for different countries?
Try the World Telephone Numbering Guide site. Hope this helps.
What support does J2ME provide for internationalization (I18N)?
The J2ME CLDC specification describes which internationalization (I18N)
and localization (L10N) features are required of CLDC based devices, which
features are left to profiles (such as the Mobil...more
How do I get a list of month names for a locale?
Pass the locale to the DateFormatSymbols constructor and ask for the list of month symbols:
Locale locale = new Locale("es", "ES");
DateFormatSymbols symbols =
new DateForm...more
How do I get a list of weekday names for a locale?
Pass the locale to the DateFormatSymbols constructor and ask for the list of weekday names:
Locale locale = new Locale("es", "ES");
DateFormatSymbols symbols =
new DateForm...more
I have downloaded TTF fonts, in my case for tamil. What should I do in order to view the font in my Java application?
When you say "view the font" I assume you mean "activate or use the font." If you are using JDK 1.2 or later, you have two options for using the font:
Use its name directly i...more
I use a servlet to export WML on the Nokia Toolkit. Why can't I output a Chinese String (GB2313 or UNICODE)?
The WAP protocol gaurantees only 7-bit ASCII, which limits you to the most basic character sets.
Most 'phones will support 8-bit ASCII. AFAIK none support Unicode.
If my servlet or JSP contains international characters (like "Ýðüö"), how do I ensure they are displayed correctly?
The simplest way is to write your JSP (or strings in your servlet) to use the HTML entity escape characters for Unicode. For instance, the string "Ýðüö" would be rep...more