keeping_it_simple keeping_it_simple - 1 month ago 14
Java Question

encoding issue in my web application

I am facing an encoding issue in my web application.

I am using properties file (resource bundle) to store language text.

If I check encoding of my properties file using notepad, it's UTF-8 and I see proper arabic character when I open it in notepad.

LOGIN=دخول


When I build my application using JDeveloper, in my properties file under classes folder, arabic characters are converted like this:

LOGIN=\u062f\u062e\u0648\u0644


Also encoding of this file is shown as ANSI in notepad.

Surprisingly, in browser, characters appeared perfectly fine (دخول).

Now when I build my application using ant, I've a copy task which is copying this properties file from src folder to classes folder.
After running build script, if I see encoding of properties file under classes folder, it still is UTF-8 and characters are in arabic only.

However in browser, characters doesn't appear properly.

As far as I know UTF-8 encoding is supposed to cater for all languages but in my case something is wrong somewhere.

I tried following also in copy task:

encoding="UTF-8" outputencoding="UTF-8"


However still no luck.

Anyone know where I am wrong?

Thanks.

Answer

Well, the comment and link provided by Edwin did help. I moved my translations to XML bundles (also called as XLF or XLIFF bundle in ADF) and now everything is working fine.

Thanks.