8042889: (props) Properties.loadFromXML/storeToXML should consistently use the UKit parser

huizhe wang huizhe.wang at oracle.com
Tue May 13 16:00:55 UTC 2014


On 5/13/2014 1:50 AM, Alan Bateman wrote:
> On 12/05/2014 20:22, huizhe wang wrote:
>>
>> Would you think the wordings in the javadoc of Properties could be 
>> stronger in terms of encoding, e.g. instead of:
>> The |loadFromXML(InputStream)| 
>> <http://docs.oracle.com/javase/8/docs/api/java/util/Properties.html#loadFromXML-java.io.InputStream->and 
>> |storeToXML(OutputStream, String, String)| 
>> <http://docs.oracle.com/javase/8/docs/api/java/util/Properties.html#storeToXML-java.io.OutputStream-java.lang.String-java.lang.String->methods 
>> load and store properties in a simple XML format. By default the 
>> UTF-8 character encoding is used, however a specific encoding may be 
>> specified if required. Implementations are required to support UTF-8 
>> and UTF-16 and may support other encodings.
>>
>> change it to:
>> The |loadFromXML(InputStream)| 
>> <http://docs.oracle.com/javase/8/docs/api/java/util/Properties.html#loadFromXML-java.io.InputStream-> 
>> and |storeToXML(OutputStream, String, String)| 
>> <http://docs.oracle.com/javase/8/docs/api/java/util/Properties.html#storeToXML-java.io.OutputStream-java.lang.String-java.lang.String-> 
>> methods load and store properties in a simple XML format. The default 
>> character encoding is UTF-8 which is the recommended encoding for all 
>> Properties files in XML format. Applications should use UTF-8 to 
>> avoid potential encoding errors. Implementations are required to 
>> support UTF-8 and UTF-16.
>>
>>
>> XML specification requires processors to support both UTF-8 and 16. 
>> But UTF-8 is the dominant encoding for XML files. The above 
>> suggestion is "stronger" in terms of using UTF-8, but not as strong 
>> as for example, Google's Sitemap service that was straight forward in 
>> their requirement: "We require your Sitemap file to be UTF-8 encoded".
> A recommendation to use UTF-8 for maximum portability seems 
> reasonable, do you mind if create a separate issue for that?

That would be fine.  Saw the JBS entry, thanks!

Joe

>
> -Alan




More information about the core-libs-dev mailing list