Hi, All!
Never mind my question. I so far have found decent workarounds for GWT
hosted mode servlet character encoding issues.
This is how the file generator code looks like:
public class ExcelServlet extends HttpServlet {
public void doGet(
HttpServletRequest request,
HttpServletResponse response
) ....
// Unfortunately, these two are broken in GWT Hosted mode
// request.setCharacterEncoding("utf-8");
// response.setCharacterEncoding("utf-8");
....
// Under GWT Hosted mode request.getParameter family returns
gibberish
// Parse query string manually using String.split("\\&") +
URLDecoder.decode(value, "utf-8")
Map<String,String> params =
getInputQueryParameters(request.getQueryString(), "\\&", true);
...
// Avoid using UTF-8 in MIME headers, because GWT hosted mode
Tomcat doesn't let us
// specify their encoding. Use percent-encoded form instead:
// Use UTF-8 for filename encoding
if (userAgent.contains("MSIE") || userAgent.contains("Chrome"))
{
// non-standard plain encoding scheme works on IE 6/7 and
Chrome (tested 0.2.149.30)
sendFile.append("filename=").append(URLEncoder.encode(sendFileName,
"utf-8"));
}
else {
// This is RFC2231. In theory should work everywhere, but in
practice IE6 and Google Chrome are
// not compliant. Opera 9.6 and FF3 tested ok.
sendFile.append("filename*=UTF-8''").append(URLEncoder.encode(sendFileName,
"utf-8"));
}
response.setHeader("Content-Disposition", sendFile.toString());
....
Thanks!
Nikolay Samofatov
On Oct 15, 3:58 am, Nikolay Samofatov
> In regular Tomcat I can setURIEncodingattribute for connector and
> everything works correctly:
> <Connector port="8080" protocol="HTTP/1.1"
> connectionTimeout="20000"
> redirectPort="8443"URIEncoding="UTF-8"/>
>
> What is the proper way to setURIEncodingconnector attribute for