DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12105>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12105

UTF Encoding is not preserved





------- Additional Comments From [EMAIL PROTECTED]  2003-07-22 16:43 -------
>>Is any additional Java code required to expose the problem?<<
Yes, my bad code!  Using org.apache.xalan.xslt.Process indeed worked 
correctly.  I am using pre-compiled templates and transforming the results to 
directly to an HTTP response.  However, I was incorrectly streaming to a 
Writer instead of an OutputStream (see code snippet below).  The Writer was 
incorrectly encoding (again) the already properly encoded transformation 
results.

Sorry for the false alarm.

  public void sendTransformedResultDocument(
                  Element result_,
                  Transformer transformer_,
                  HttpServletResponse response_) throws MySTException
  {
      String mediaType = transformer_.getOutputProperty("media-type");
      response_.setContentType(mediaType);

      try
      {
          transformer_.transform(
                          new DOMSource(result_),
  //original (bad!) line: new StreamResult(response_.getWriter()) );
                          new StreamResult(response_.getOutputStream()) );
      }
      .
      .
      .

Reply via email to