I18N Section Index
What's a BOM?
BOM stands for Byte Order Mark and could be the initial bytes of a UTF-encoded stream, typically used to indicate endianess of the stream. Prior to Java 6, if present, your program needed to handl...more
How do I convert HTML form data from ASCII/HTML representation to a true Java Unicode string?
How do I convert HTML form data from ASCII/HTML representation to a true Java Unicode string? I have a JSP that stores what should be a Unicode stream into a NCLOB. The insert happens fine, however...more
What is TMX?
TMX stands for Translation Memory eXchange. From the definition at TMX Format - Specifications: "The purpose of the TMX format is to provide a standard method to describe translation memory data ...more
I'm creating a ZIP file using java.util.zip.ZipOutputStream. If the file names of these files are in any other language other than English (e.g. Chinese) they get distorted. when I extract the ZIP file using WinZip. How do I preserve the file names?
WinZip, and the ZIP file format in particular, only supports
ASCII characters for file names. The Java class ZipOutputStream
can't give you a capabillity which is not supported by the
underlying ...more
Where can I find on-line, linkable currency converters?
There are many sites like Canada's Royal Bank that convert only to local currencies ( US and Canadian dollars ), and others like the domino.kappa.ro, that uses the rates of the National Bank of Ro...more
I need to present a "mask" on a GUI screen representing a date in the current locale's short format, which may include a 4-digit year. How do I know which field is the year? I can get the localized pattern used by the DateFormat object, but the symbols seem to change based on the Locale!
Use SimpleDateFormat.toPattern() to get the unlocalized pattern ( as opposed to toLocalizedPattern() ). The returned String uses the symbols referenced in the SimpleDateFormat documentation.
F...more
How can I have an XML-based resource bundle?
Until JDK 6.0, you can't. Only ListResourceBundles and PropertyResourceBundles are supported. With 6.0, you can create a custom ResourceBundle.Control implementation which allows you to support AN...more
How can I store international / Unicode characters into a cookie?
Example:
I would like to put this String: "até" The problem is when I get the cookie value I receive "at".
----------------------
One way is that before storing the cookie URLEncode it.
...more
What are the considerations for searching text in Java? Are there any tools available?
Efficient text searching in Java: Finding the right string in any language by Laura Werner provides a good overview, along with code, of I18N and Unicode text search issues. As pointed out in the...more
In the article Internationalizing Servlets, the author states the current PropertyResourceBundle class is less efficient in a multithreaded world (like in J2EE/servlets) because it's based on Hashtable, that has synchronized calls.
In the article Internationalizing Servlets, the author states the current PropertyResourceBundle class is less efficient in a multithreaded world (like in J2EE/servlets) because it's based on Hasht...more
How can I obtain the languages spoken in a country? For example, Locale has a private method getLanguagesForCountry, but I can't use it since it's private. Is there another way to obtain the languages spoken in a given country?
This is an interesting question because the answers, none of which may be satisfactory, depend on how the information is to be used.
"I want to present countries and the languages spoken in them ...more
How can I set a customized currency symbol to be applied to a number?
How can I set a customized currency symbol to be applied to a number?
DecimalFormat df = new DecimalFormat();
DecimalFormatSymbols dfs = new DecimalFormatSymbols();
dfs.setCurrencySymbol("Rs");
df...more
How is non-default character encoding specified for an XML document?
For non-default encoding, the XML text declaration should contain an encoding declaration as in the following examples:
<?xml encoding='UTF-8'?>
<?xml encoding='EUC-JP'?>
Acceptable...more
What is the default encoding for HTML and XML?
Through HTML 3.2, the eight bit standard was ISO 8859-1. As of HTML 4.0, the default document character set is Unicode. For XML, the absolute default is UTF-8. However, a Byte Order Mark ( BOM ...more
How can I display the current time as GMT?
Create a custom TimeZone and use it for DateFormat.setTimeZone(). This is discussed briefly in the API documentation and shown in the following code.
import java.text.*;
import java.util.*;
pub...more