Character Encoding in Tapestry
I need to output CHinese on webpage and gb2312 is required. I was testing for a night and didn't find a way to do this untill I saw this post on mailinglist.
In short, should add something like this:
to the .application file or to the relevant .page files and the templateswould use the UTF-8 encoding.
and then extends BasePage like this:
public IMarkupWriter getResponseWriter(OutputStream out) {
HTMLWriter writer = new HTMLWriter("text/html; charset=GB2312",
out);
//getPage().getEngine().setLocale(Locale.CHINESE);
return writer;
}
Reference:
Encoding
In short, should add something like this:
to the .application file or to the relevant .page files and the templateswould use the UTF-8 encoding.
and then extends BasePage like this:
public IMarkupWriter getResponseWriter(OutputStream out) {
HTMLWriter writer = new HTMLWriter("text/html; charset=GB2312",
out);
//getPage().getEngine().setLocale(Locale.CHINESE);
return writer;
}
Reference:
Encoding


0 Comments:
Post a Comment
<< Home