struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Mann <rm...@latencyzero.com>
Subject Character encoding of custom tag output
Date Wed, 16 Jul 2003 04:04:35 GMT
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


Mime
View raw message