File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Using UNICODE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Using UNICODE" Watch "Using UNICODE" New topic


N Jain

Joined: Aug 11, 2007
Posts: 14

I am working on a java project, which needs to incorporate
Internationalisation and Localisation. It has been suggested that the
locale specific ".properties" ( that
contain UNICODE equivalent of the Arabic text in my case.

My questing is why not use the Arabic text messages rather than their
UNICODE equivalent in the "" file? What problems will
this cause?

All suggestions will be highly appreciated.

Thank you,
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

The rules for Properties files include a rule that the file must be encoded in ISO-8859-1. As the API documentation for (the Java 1.4 version of) java.util.Properties says:
When saving properties to a stream or loading them from a stream, the ISO 8859-1 character encoding is used. For characters that cannot be directly represented in this encoding, Unicode escapes are used; however, only a single 'u' character is allowed in an escape sequence. The native2ascii tool can be used to convert property files to and from other character encodings.
However if you are using Java 5 or later, you can use the XML format for properties, which doesn't have that restriction. The API documentation for java.util.Properties explains that too.
Bill Shirley
Ranch Hand

Joined: Nov 08, 2007
Posts: 457
UNICODE is the encoding (as opposed to ASCII, for example).

Arabic (as opposed to Cyrillic, for example) is a human script.

Bill Shirley - bshirley -
if (Posts < 30) JavaRanchFAQ);
It is sorta covered in the JavaRanch Style Guide.
subject: Using UNICODE
It's not a secret anymore!