fredag, oktober 13, 2006

ResourceBundle pain.

I just found out something very disturbing and annoying. Java Property-files (and ResourceBundles in extension) will only load files in ISO-8859-1 format. Of course, you can use Unicode escape codes in the files, but that is not very convenient. Java is, over all, really good at internationalization, but this is one sore spot. And it doesn't seem to go away in Java 6 either. Isn't it highly ironic that ResourceBundles can't use regular UTF-8-files?

4 kommentarer:

I think that you can use the "native2ascii" program that comes with the sdk to convert your property files after you are done editing them. It's a little less annoying than trying to edit the files in \uxxxx format. Or, if you use Vim, try my unicodeswitch.vim plugin to view in utf-8 and write in the \uxxxx format: http://www.vim.org/scripts/script.php?script_id=909

I hear you Ola. I went through the same realization a few months ago. Roger: I didn't know about native2ascii and I ended up essentially writting my own version of it. Documentation was weak overall, I had to go through a lot of digging.