How do I specify an encoding for TextCells in CellList?
I use a CellList like this
CellList<String> cellList = new CellList<String>(new开发者_如何学运维 TextCell());
and then give it an ArrayList<String>
.
If a String contains an "ü" I get a question mark in the browser (FF4, GWT Dev Plugin). If I use ü
I get ü
Where can I specify the encoding, so that "ü" works? (I'm not sure if it makes a difference, but the "ü" is currently hardcoded in the .java file and not read from somewhere else).
The GWT compiler assumes, that your Java files are encoded in UTF-8. Make sure, that your editor is set to save in that encoding.
You should also make sure to set the encoding of the HTML page to a unicode capable encoding like UTF-8 (this allows you to use even more exotic characters that you won't find in other charsets):
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
...
Moreover, if you later want to retrieve the strings from a database, make sure, that it is also set up to handle Unicode, and that your JDBC driver connects in Unicode mode (required for some databases).
精彩评论