简体   繁体   中英

ZK internationalization: UNICODE instead of accented character

My application uses Labels for internationalization.

In all pages, the accented characters are shown as unicodes. Eg,

à ---> \u00E0

I have no idea which can be the problem and I can't find any useful documentation on this topic: I only found http://forum.zkoss.org/question/14643/internationalization-accent-characters/?answer=101862#post-id-101862 but all the suggested links are dead.

Properties file are edited with Eclipse ResourceBundle Editor which saves accented letters as unicode: I don't know why the accented characters are rendered as \\uXXXX.

Thanks in advance for the collaboration.

At the end I solved the problem.

IT IS ONLY A PROBLEM OF ENCODING , as chillworld and others in other fora said (thanks for driving me on the right way!).

I had to implement multiple tricks to have my application working correctly:

  1. rename .properties files to .labels : this is because Eclipse assumes that all properties files are ISO-8859-1 encoded and if you want to be sure that it preserves your encoding you have to rename it. Most important, be sure that the files are UTF-8 encoded (right click in Eclipse on the file, click on 'Properties', encoding is in the last line). To modify the encoding you can use an external editor (SublimeText, UltraEdit, Geany, gedit,...) or within Eclipse go to Edit->Set Encoding and choose UTF-8.

  2. avoid using the ResourceBundle Editor eclipse plugin or other properties editors (like JBoss Properties Editor): the problem is that they automatically convert accented letters to escaped unicode sequences because they assumes that the properties files are ISO-8859-1 encoded.

  3. replace all the occurrences of the unicode sequences with the corresponding character (eg, replace with à , and so on...).

  4. finally, restart Tomcat: it should work.

Did you bother checking ZK's I18N files?

Here is the first 3 lines of it :

#"charset=utf-8"
#Created on Sept 21, 2006, by Jérôme Vergereau
#Copyright (C) 2006 Potix Corporation

As you can see, it's saved as UTF-8 and not unicode, so please try UTF-8 as encoding.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM