Java 9 - Internationalization


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

Internationalization Enhancements in JDK 9 By Gowtham Girithar Srirangasamy
package com.demo.unicode;
import java.util.Properties;
import java.util.PropertyResourceBundle;
* Class to describe the java 9 features of Internationalization in JDK 9
* Java 9 Features Demo with modular development.
* @author Gowtham Girithar Srirangasamy
public class DemoUnicode {
* For the content is
* key =€ / \u20AC
* mood = 😎 / \uD83D\uDE0E
* chineese =
public static void main(String[] args) throws FileNotFoundException, IOException {
/** demo for PropertyResourceBundle and Properties */
System.out.println("Internationalization Enhancements in JDK 9 ");
System.out.println("Inputs are");
System.out.println("key =€ / \u20AC");
System.out.println("mood = 😎 / \uD83D\uDE0E");
System.out.println("chineese =");
System.out.println("****** With Property Resource Bundle************ ");
withPropertyResourceBundle(new FileInputStream(""));
System.out.println("****** With Properties************ ");
withProperties(new FileInputStream(""));
* This method will read the value from the property file and write into the another one.
* This method will print the actual characters.
* @param propertyFile
* @throws IOException
private static void withPropertyResourceBundle(InputStream propertyFile) throws IOException {
/** the text file is created becuasue the console might not have UTF-8 support for many*/
PrintWriter writer = new PrintWriter("output_1.txt", "UTF-8");
PropertyResourceBundle properties = new PropertyResourceBundle(propertyFile);
/** iterate and print the values*/
properties.getKeys().asIterator().forEachRemaining(key -> {
String value = properties.getString(key);
/** Printing the value will help for whom UTF-8 will be supported*/
System.out.println(key + " = " + value);
/**printing in file*/

#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.

Create your playground on
This playground was created on, our hands-on, knowledge-sharing platform for developers.
Go to
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
Online Participants