Loading [Contrib]/a11y/accessibility-menu.js
Back
Close

Java 9 - Internationalization

Gowgi
2,036 views

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.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Properties;
import java.util.PropertyResourceBundle;
/**
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

#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 Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants