tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hirofumi Arimoto" <ari...@geocities.co.jp>
Subject encoding bug
Date Sat, 06 May 2000 06:07:18 GMT
  Hi, all.
  I found a bug relating to an encoding. I'm now using tomcat v3.1 , which
can't send cookies including japanese characters.
  Its root cause is the method
org.apache.tomcat.service.http.HttpResponseAdapter#endHeaders.  In this
method, the content of headers is forcely encoded as "8859_1".
  So please change to take care of an encoding correctlly when write
headers. I have now seen the CVS repository, but it seems that this bug have
been not fixed yet.
  Here is a fix:
----
before:
sout.write( headersSB.toString().getBytes(Constants.CharacterEncoding.Defaul
t) );
----
after:
String encoding = getCharacterEncoding();
if(encoding == null)

out.write( headersSB.toString().getBytes(Constants.CharacterEncoding.Default
) );
else
  try {
    sout.write( headersSB.toString().getBytes(encoding) );
  }catch(java.io.UnsupportedEncodingException ex) {

out.write( headersSB.toString().getBytes(Constants.CharacterEncoding.Default
) );
    System.out.println("Unsuported encoding: " + encoding );
}
----

  i hope you understand my english :-)
  happy hacking!

---
 << Hirofumi Arimoto. Kobe,Japan. >>
   Internet Mail      : arimot@geocities.co.jp
   Yahoo Pager Japan  : arimoto
   AOL IM Japan       : arimot
   ICQ                : 6795777
---



Mime
View raw message