Home > Java > javaTutorial > body text

What improvements are there in internationalization in Java 9?

王林
Release: 2023-09-08 21:49:02
forward
853 people have browsed it

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>
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template