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:
If problems arise, we can consider the following options:
<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!