-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello,
I'm having a annoying problem. I use IntelliJ IDEA 8.1.1 #9805 and my project is configured to use UTF-8 encoding. The problem is, I made a page (using zk framework, bu I don't it matters) to build a tree for a menu:
And the first item of the tree is:
<treerow> <treecell label="Página Inicial"/> </treerow>
This was working and the "á" character appears correct on the browser. But I need to to build the menu from the code to it be dynamic, so I did a java file with this:
static { menuItems = new ArrayList(); menuItems.add("Página Inicial"); }
And bound the page to this menuItems, and now when the page is loaded in the browser I get this: "Página Inicial". The meta content type is set correctly to UTF-8.
It only works if I change it to menuItems.add("P\u00E1gina Inicial"), but shouldn't it work without this \u characters?
I'm pretty new to ZK. How composer java source is transformed into a browser page: is the source compiled, or html is generated directly from source, or ... ?
Regards,
Felipe Cypriano
Yeah I already looked it. I've the meta tag defined correctly but it doesn't work.
What IMO is more strange is that if I put the special character direct in zul file the HTML is generated correctly, but if I put it in a java composer and set the tree's model to an attribute of the java class the generated html isn't correctly. Why?
Regards,
Felipe Cypriano
have you checked the encoding of your java class?
Probably your charset is not UTF-8.
You shoud try to use the String(byte[] bytes, String charset) constructor, passing "UTF-8" as charset.
My idea is that it would be much better if you put your strings inside an UTF-8 property file, and them use the ZK functions to localize your application (you can use the Labels.getLabel method).
Asked: 2009-04-17 13:15:09 +0800
Seen: 231 times
Last updated: Apr 20 '09