---
Ted Rice
APAMA Ltd, 17 Millers Yard, Mill Lane
Cambridge CB2 1RQ, United Kingdom
Email:  [EMAIL PROTECTED]
Mobile: +44 (0)7899 876489
Phone:  +44 (0)1223 257973 [Histon Office]
Fax:    +44 (0)1223 51885> A little further information on my encoding
problem
> with the JSP Tags and XML translation.
>
> When I remove the JSP BodyTag wrapper around the
> JSP code producing XML, the XML is shown in the
> browser and all the UTF8 characters are displayed
> properly. Meaning that in the processing of the
> JSP the encoding is being preserved.
>
> However, in the JSP Tag Code, I have done the
> following test:
>
> public int doAfterBody() throws JspException {
>       // _xmlContent is a member variable instance
>
>     if (bodyContent == null){
>       _xmlContent = "";
>     }
>     else{
>       _xmlReader  = (InputStreamReader) bodyContent.getReader();
>
>       logger.debug("Reader Encoding [ " +
> _xmlReader.getEncoding() + " ]");
>     }
>
>     return SKIP_BODY;
> }
>
> In my log file I see the following line:
>
> 2001-02-01 10:12:28,902 [ApplicationServerThread] DEBUG Reader
> Encoding [ Cp1252 ]
>
> Meaning the encoding of the bodyContent reader is where the
> munging is occurring. Is there a way I can force the
> reader to use UTF8 encoding?

I have circumvented the problem of encoding being
lost via a hack. The code was:

      byte[] utf8Bytes = bodyContent.getString().trim().getBytes("Cp1252");
      ByteArrayInputStream stream = new ByteArrayInputStream(utf8Bytes);
      _xmlReader = new InputStreamReader(stream, "UTF-8");

This is going to be slow! I guess the real problem lies that
the Reader of the bodyContent is reading in Cp1252. How can
i force the Tag to read in UTF8?

Thanks.

---
Ted Rice
APAMA Ltd, 17 Millers Yard, Mill Lane
Cambridge CB2 1RQ, United Kingdom
Email:  [EMAIL PROTECTED]
Mobile: +44 (0)7899 876489
Phone:  +44 (0)1223 257973 [Histon Office]
Fax:    +44 (0)1223 5188599


Reply via email to