commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Janek Bogucki <...@studylink.com>
Subject [latka] UTF-16 was wrong encoding choice
Date Thu, 19 Sep 2002 12:07:06 GMT

I submitted a patch to o.a.c.latka.http.RequestImpl to stop it using a 
deprecated method in httpclient. My code used UTF-16 as the encoding

InputStream  is = new 
ByteArrayInputStream(_requestBody.getBytes("UTF-16"));
((PostMethod) _httpMethod).setRequestBody(is);

My choice of a two byte encoding is seriously broken because the stream is 
later accessed one byte at a time in o.a.c.httpclient.methods.PostMethod 

        int data = requestBody.read();

        while (data != -1) {
            buffer.append((char) data);
            data = requestBody.read();
        }

In my sandbox I have changed to use ISO-8859-1 but would like some other 
opinions before I post a patch to undo the UTF-16 mistake. Is ISO-8859-1 the 
right choice?

Thanks,
Janek Bogucki

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message