tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zhu Ming" <m...@bequbed.com>
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\ResponseImpl.java
or
http://jakarta.apache.org/cvsweb/index.cgi/jakarta-tomcat/src/share/org/apac
he/tomcat/core/Attic/ResponseImpl.java?rev=1.33.2.5&content-type=text/vnd.vi
ewcvs-markup

    /** Write a chunk of bytes. Should be called only from
ServletOutputStream implementations,
     *	No need to implement it if your adapter implements
ServletOutputStream.
     *  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.

Ming
----------------
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 [mailto:michael@bailey.dscga.com]
Sent: Monday, February 05, 2001 11:55
To: tomcat-dev@jakarta.apache.org
Cc: michaelm@netsol.com
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'...

-MM

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!       | www.rwhois.net/michael
Sr. Research Engineer   |   www.ga.lp.org/gwinnett     | ICQ#:
14198821
Network Solutions	|          www.lp.org          |  michaelm@netsol.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, email: tomcat-dev-help@jakarta.apache.org


Mime
View raw message