views:

33

answers:

2

I have a java application which has a GUI in both English and French, using the standard Java internationalisation services. I wrote it in JBuilder 2005 on an old machine, and recently upgraded, which has meant changing IDEs. I have finally settled on IntelliJ, which I adore.

However, it doesn't seem able to handle the accented characters in my ListResourceBundle descendants which contain French. When I first created the IntelliJ project and added my source (which I did manually, to be sure nothing weird was going on behind the scenes), I noticed that all the accented characters had been changed into pairs of characters such as é. I went through the code and corrected all of these, and assumed that the problem was fixed.

But I find on running the (rebuilt) project that the pairs of characters are still showing, instead of the accented characters that I see in my code!!

Can someone who has done internationalisation in IntelliJ please tell me what I need to do to fix this?

Grateful TIA!

PS I'm on the Mac, BTW

A: 

Java resource bundles should only hold ascii and Unicode escape codes see [http://java.sun.com/developer/technicalArticles/Intl/ResourceBundles/].

e.g. \u00d6ffnen for German Öffnen.

The command line tool native2ascii converts from your native format to ascii plus unicode escape codes. It is a bit of a hassle but not an Intellij but a Java problem.

Note: I use Intellij on a Mac to create programs localized in English, German and Japanese.

openCage
Thanks...I tried this, and now instead of é I have "\u221a\u00a9" in the file, but when I run the program, I still get √© !!!Help??
skiaddict1
A: 

Two things --

First, make sure your files are being stored as UTF, and that your source control supports the encoding.

Second, consider using the resource bundle editing support built into IntelliJ http://www.jetbrains.com/idea/features/i18n_support.html

Dilum Ranatunga
Wow, I just took a look at the I18n support in IntelliJ! Yet another reason to be totally in love with this product. Thanks so much.
skiaddict1
Also, I don't know how to do what you suggest in your first sentence. Can you be a bit more specific, please?
skiaddict1
Sorry I was sleepy when I responded. Check out [http://jetbrains.dzone.com/articles/new-approach-encoding] for setting file encoding.The advice I wish to convey is to be very deliberate about file encoding in your project. You can choose to use 1521 and use escapes for everything, or use a UTF8 and embed the actual characters in your code. As @openCage has indicated, properties files will still be locked into ascii-only, but with i18n, my experience has been that test cases, then some code invariably starts needing to use non-ascii characters as well.
Dilum Ranatunga
WRT source control, some source control systems misbehave when they expect a text file encoding that doesn't support all the characters you write without escaping. Diff and merge etc have issues.If your team is entirely US based, 1521 is not a bad choice. If you are geographically spread out, UTF is the way to go.
Dilum Ranatunga
Thanks...sorry, I was also sleepy when I responded! I should have mentioned that currently I don't have any source control. This isn't as shocking as it might seem -- I'm the only developer. It's on my wish list to set up one day :-) When I do, I'll keep your comments in mind.BTW I got the thing working tonight, set the file encodings and everyone's happy. I chose UTF8 so that I can see the actual text in my files. Feels better that way. On to the next problem! :-)Have a good weekend
skiaddict1