Exemple:
by default its assumes "charset=UTF-8", but i need to set the charset
to "iso-8859-1" (i am from Brazil ;) ), because UTF-8 losts character
acentuation.
Thats it, thanks in advance!
Something that you could look :
1- Verify if really the browser recives correct webserver codification
like UTF-8 test charset browser codification you recive ( or is asuming
other ).
2- Be sure that the code editor you're using , writes files on UTF-8 (
if you're on windows environment is a normal isue that editor not makes
it, on linux files are normally writen on UTF-8 ).
If you want to set ISO-8859-1 charset I think on index.html page ( or
your GWT entry page ) put <meta http-equiv="Content-Type"
content="text/html; charset=ISO-8859-1" />
and in the java class file i set text of components:
<code>
final Button button = new Button("Olá");
final Label label = new Label();
label.setText("Acentuação");
</code>
The browser (firefox) responses:
Ol? (on button)
Acentua??o (on label)
i have tried setting:
<code>
final Button button = new Button("Olá");
final Label label = new Label();
label.setText("Acentuação!");
</code>
Browser responses:
Olá (corretly!)
Acentuação! (wrong!)
can you help me?
Thanks for reply!
// on Label.class
public void setText(String text) {
DOM.setInnerText(getElement(), text);
}
//on HTML.class
public void setHTML(String html) {
DOM.setInnerHTML(getElement(), html);
}
But I continue thinking is other problem on your environment. I'm sure
UTF-8 runs properly ( I've tested on english, spanish and japanese )
and runs well.
Something like this, new Button("ábcdéfg") must run correctly.
Usually when you receive something on webserver (and webserver sends
encoded on UTF-8 or other ) and the charsets ara incorrectly on browser
is originated by bad write code files ( or some configuration on the
web server ).
On way to test it, is to make simply .jsp file with extended
characters and bottom code, if it runs the editor and webserver
probably are well
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
I hope it could be useful
Thank you very much for your attention!
button.setText(new HTML("Olá").getHTML());
DOM.setInnerHTML(label.getElement(), "Acentuação!!");
....
Both methods worked fine!
Some people are looking how display chinese characters... i sugest read
this topic. If you know how to do that post the solution here:
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/98d3608bad1d14ba
Thank you for your help!
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
and