problem with encoding and JSPWriter
1 posts in topic
Flat View  Flat View

Posted By:   Vampyr13_13vamp
Posted On:   Tuesday, June 24, 2003 04:44 AM

Im using JSPwriter to output from UTF-8 encoded properties file. Problem is it seems JSPWriter implements PageWriter which assumes always ISO-europe-1 encoding.

I was thinking of using directly ServletOutputStream (since it doesnt do any encoding), but im not sure how.

If anyone ever had to output UTF-8 properites files from JSP tag...I would appreciate advice how to do it

Re: problem with encoding and JSPWriter

Posted By:   Joop_Eggen  
Posted On:   Tuesday, June 24, 2003 06:33 AM

You can - before writing anything else - set the content type, which magically switches to the correct Writer.
Note, that out there in the HTML world "UTF-8" is used, and java prefers the canonical form "UTF8" (though often accepts "UTF-8");

String encoding = "UTF-8";
String mimeType = getRequestMimeType(request.getRequestURI());
//if (mimeType.equals("text/html"))
response.setContentType(mimeType + ";charset=" + encoding);
About | Sitemap | Contact