tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zhu Ming" <>
Subject RE: serializing XML to a ServletOutputStream fails
Date Mon, 05 Feb 2001 12:55:17 GMT
I found the following implementation source code from
the tomcat 3.2 codeline, in src\org\apache\tomcat\core\

    /** Write a chunk of bytes. Should be called only from
ServletOutputStream implementations,
     *	No need to implement it if your adapter implements
     *  Headers and status will be written before this method is exceuted.
    public void doWrite( byte buffer[], int pos, int count) throws
IOException {
        // XXX fix if charset is other than default.
        if( body==null)
	    body=new StringBuffer();
	body.append(new String(buffer, pos, count,
			       Constants.DEFAULT_CHAR_ENCODING) );

So, it looks like that tomcat 3.2 have only implemented
ServletOutputStream for default charactor set, but not
for the others.

P.S.: Thanks the Unicode lesson. :) ... It seems I have no chance
to get $50 by my poor Unicode knowledge.

-----Original Message-----
From: Michael Mealling []
Sent: Monday, February 05, 2001 11:55
Subject: Re: serializing XML to a ServletOutputStream fails

On Mon, Feb 05, 2001 at 11:24:55AM +0100, Zhu Ming wrote:
> Maybe you should not use character set "UTF-8". I remember
> that it's 8-bit Unicode. As I know, Chinese and Korean has
> 16-bit code. So at least, you should try 16-bit Unicode.
> I forgot the name, maybe it's "UTF-16". But I'm not sure if
> JDK have fully support to "UTF-16".

UTF-8 is an encoding that allows the multibyte (16 and higher)
Unicode code points to be encoded in 8 bits, not limited to 8 bits.
If a byte has its high order bit set then you know that the next
few bytes are also part of that particular code-point. So UTF-8
also handles the entire Unicode set. XML itself defaults to UTF-8
so its something that _should_ work 'out of the box'...


P.S. I've also posted this problem to HotDispatch so if you
can help me solve the problem you could get $50... ;-)

Michael Mealling	|      Vote Libertarian!       |
Sr. Research Engineer   |     | ICQ#:
Network Solutions	|          |

To unsubscribe, e-mail:
For additional commands, email:

View raw message