Re: Plain text in Java ResourceBundle

From: John O'Conner (john.oconner@eng.sun.com)
Date: Thu Feb 22 2001 - 13:20:11 EST


I'm offering just a slight correction in the details of ResourceBundle:

The Java 2 platform provides two concrete implementations of
ResourceBundle...a ListResourceBundle and a PropertyResourceBundle. The text
you can provide in them has different constraints.

A ListResourceBundle becomes a class file. You compile it with javac. You
can create its .java file in any encoding that the Java runtime understands.
You can, for example, enter key/value pairs in UTF-8 or SJIS. If you use any
encoding other than your host's default charset encoding, you must use the
command line "javac -encoding <encoding here> <your bundle name here>" to
compile it. The text gets encoded in the Java platform's internal encoding
for Strings.

PropertyResourceBundles are flat text files...restricted to the Latin-1
charset using the values from 0x00 through 0xFF. From the standpoint that
they don't contain formatting characters or other markup, the entire file is
plain text. Someone could argue that the key=value notation is a markup of
sorts...fine. If you create a potential PropertyResourceBundle named foo.txt
in SJIS encoding, you must use the native2ascii tool to convert it to ASCII:
native2ascii -encoding SJIS foo.txt foo.properties.

All non-ASCII characters in foo.txt are converted to \uXXXX notation in the
foo.properties file. At this point, perhaps the PropertyResourceBundle is no
longer plain text...it has imposed a new encoding on character values.
Whether it is plain text or not is not my point, however. I simply wanted to
correct the statements about what can and what cannot go into a bundle.

Regards,
John O'Conner

----- Original Message -----
From: "Richard, Francois M" <Francois.M.Richard@usa.xerox.com>
To: "Unicode List" <unicode@unicode.org>
Sent: Thursday, February 22, 2001 4:09 AM
Subject: RE: Plain text in Java ResourceBundle

> I agree. Currently, ResourceBundle file are limited to US-ASCII.
> My question though was related to "plain text".
> I would guess than in any case, the VALUE of the message (e.g. "hello") is
> plain text. As a result, this would make Java code non Unicode compliant
> (?).
>



This archive was generated by hypermail 2.1.2 : Tue Jul 10 2001 - 17:21:19 EDT