Java 9 - Internationalization
Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
Welcome to Java 9 Internationalization - By Gowtham Girithar Srirangasamy
Java 9 has an improvements in Internationalization.The improvements are described below,
Unicode 8
Java 8 supported till unicode 6.2. The Unicode 6.3, 7.0, and 8.0 standards introduced 10,555 characters, 29 scripts, and 42 blocks, all of which are supported in Java SE 9.
UTF -8 Properties Files
In previous releases of Java, ISO-8859-1 encoding was used to load the property resource bundles, (i.e.,PropertyResourceBundle – constructing its instance from an InputStream requires that the input stream be encoded in ISO-8859-1). But ISO-8859-1 is not a convenient way to represent the non-Latin characters. In Java SE 9 ,property files are loaded using UTF -8 encoding.
CLDR Locale Data Enabled by Default
In JDK 8 and previous releases, JRE is the default locale data. JDK 9 sets CLDR as highest priority by default.
The Unicode 8 and UTF -8 Properties Files are explained below with an example. In the below example , we have used the property files also to print.Reason for using the output property files is to see the output ,if the console is not supporting UTF-8
Hands-on Demo
#Explanation on Output
In the above program, we have given the input in property files and then output is printed in console and also in the text files.UTF-8 is supported in PropertyResourceBundle.