You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rick Mann <rm...@latencyzero.com> on 2003/07/16 18:38:59 UTC

Character encoding of custom tag output SOLVED

Turns out, I was wrong. Java is doing the right thing. Thanks!

--------------------------

We have a situation where we've created a custom <foo:include> tag that
reads text from a file and writes it to the pageContext.getOut() JspWriter.

The problem is that the file is ISO-8859-1 (Latin 1) encoded. When it gets
brought into a String (via any method you care to suggest), it gets
converted to UTF-16 (Java's internal representation). When it subsequently
gets written out, it's a stream of UTF-16-encoded bytes that the browser
interprets as ISO-8859-1 latin text.

We cannot change the META tag to indicate that the text is UTF-16, because
the rest of the JSP is latin 1.

There does not appear to be a way to output raw bytes to the output stream,
nor does there appear to be a way to tell the JspWriter that it should be
printing Strings by encoding them into ISO-8859-1. (I really hope I'm wrong
on this last point).

Does anyone have any suggestions on how we can cope with this situation? I
find it hard to believe that it's a rare problem.

Thank you.

-- 
Rick


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org