• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ResourceBunde in Unicode?

 
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does it strike anyone as odd that the very class that is meant to solve the internationalization problem (ResourceBundle) does not speak Unicode?

Anyway, I found a patch for it here:
http://www.thoughtsabout.net/blog/archives/000044.html, But it still won't read my Unicode files correctly; everything is garbled. What am I doing wrong?


 
Jane Jukowsky
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found this comment in PropertyResourceBundle:

* <strong>Note:</strong> PropertyResourceBundle can be constructed either
* from an InputStream or a Reader, which represents a property file.
* Constructing a PropertyResourceBundle instance from an InputStream requires
* that the input stream be encoded in ISO-8859-1. In that case, characters
* that cannot be represented in ISO-8859-1 encoding must be represented by
* <a href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3">Unicode Escapes</a>,
* whereas the other constructor which takes a Reader does not have that limitation.


I don't want to unicode-escape. So, how do I instantiate ResourceBundle using the constructor which takes a Reader? I don't have a debuggable version of rt.jar (which is a whole separate question). All I can tell that the bunde is instantiated (using the wrong constructor) in ResourceBundle.Control inner class.

 
Rancher
Posts: 600
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jane:

Since ResourceBundle is abstract, why don't you extend it and create a UnicodeResourceBundle class?

John.
 
Jane Jukowsky
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

John de Michele wrote:Jane:

Since ResourceBundle is abstract, why don't you extend it and create a UnicodeResourceBundle class?

John.



The example above is already trying to do that. However, the logic in ResourceBundle is kind of mind-boggling, and without an adequate debugger, finding an elegant hook without rewriting the whole thing does not appear to be easy. I am thinking of giving up on ResourceBundle altogether and implementing my own logic from scratch, unless someone here helps.

reply
    Bookmark Topic Watch Topic
  • New Topic