Home >Java >javaTutorial >What improvements are there in internationalization in Java 9?

What improvements are there in internationalization in Java 9?

王林
王林forward
2023-09-08 21:49:02866browse

Java 9中国际化方面有哪些改进?

Internationalizationenhancements in Java 9 include Unicode 8.0, UTF-8 properties files, and enabling CLDR LocaleDataBy default. Java 9 supports up to Unicode 8.0 standard with 10,555 characters, 29 scripts, and 42 blocks.

In Java 9, properties files are loaded in UTF-8 encoding. By default, reading an input stream throws MalformedInputException or UnmappableCharacterException. In this case, the PropertyResourceBundle instance is reset to the state before the exception, re-reads the input stream in ISO-8859-1, and then continues reading.

If PropertyResourceBundle. Encoding is set to ISO-8859-1 or UTF-8Then the PropertyResourceBundle instance reads the encoded input stream and throws an exception if an invalid sequence is encountered. System properties are read and evaluated when the PropertyResourceBundle class is initialized, and any operations that change or delete the property have no effect.

If we specify ISO -8859-1:

  • cannot be encoded with ISO-8859-1 The character strong> represented by must be represented by the Unicode escape character .
  • Other encoding values ​​have ignored the properties of this system.

If problems arise, we can consider the following options:

  • Convert the properties file to UTF-8 encoding.
  • Specify runtime system properties.
<strong>java.util.PropertyResourceBundle.encoding=ISO-8859-1</strong>

The above is the detailed content of What improvements are there in internationalization in Java 9?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete