What are the enhancements in Internationalization in Java 9?

JavaObject Oriented ProgrammingProgramming

<p><strong>Internationalization </strong>enhancements in Java 9 include <strong>Unicode 8.0</strong>,<strong> UTF-8</strong> properties files and enabling <strong>CLDR </strong><strong>locale </strong><strong>data </strong>by default. Java 9 supports up to <strong>Unicode </strong><strong>8.0 standards</strong> with 10,555 characters, 29 scripts, and 42 blocks.</p><p>In Java 9, the properties files are loaded in<strong>&nbsp;UTF-8 encoding</strong>. By default, reading an input stream throws <strong>MalformedInputException&nbsp;</strong>or <strong>UnmappableCharacterException</strong>. In this case, <strong>PropertyResourceBundle&nbsp;</strong>instance reset to a state before the exception, re-reads the input stream in <strong>ISO-8859-1</strong>, and continues reading.</p><p>If <strong>PropertyResourceBundle.</strong><span style="font-weight: 700; background-color: initial; text-align: initial;">encoding</span><span style="font-weight: 700; background-color: initial; text-align: initial;">&nbsp;</span><span style="background-color: initial; text-align: initial;">has set to either&nbsp;</span><strong style="background-color: initial; text-align: initial;">ISO-8859-1</strong><span style="background-color: initial; text-align: initial;">&nbsp;or&nbsp;</span><strong style="background-color: initial; text-align: initial;">UTF-8</strong><span style="background-color: initial; text-align: initial;">, then <strong>PropertyResourceBundle </strong>instance read an input stream in that encoding, and throw an exception if encountering an invalid sequence. The system property read and evaluated when initializing the <strong>PropertyResourceBundle </strong>class, then any action that changes or removes the property has no effect.</span></p><p>If we specify<strong> ISO-8859-1</strong>:</p><ul class="list"><li>Characters that can&#39;t be represented in <strong>ISO-8859-1</strong> <strong>encoding&nbsp;</strong>must be represented by <strong>Unicode&nbsp;</strong><strong>escapes</strong>.</li><li>Other encoding values have ignored this system&#39;s property.</li></ul><p style="">If there is an issue, we can consider the below options:</p><ul class="list"><li>Convert the <strong>properties file</strong> into <strong>UTF-8 encoding</strong>.</li><li>Specify the runtime system property.</li></ul><pre class="prettyprint notranslate" style=""><strong>java.util.PropertyResourceBundle.encoding=ISO-8859-1</strong></pre>
raja
Updated on 06-Mar-2020 07:32:25

Advertisements