Geir, The wirelog displays (is intedned to display) what gets physically transmitted across the wire escaping all potentially non-printable characters, hence the US-ASCII charset. What you see is what you get, sort of. I suspect that this is not just the problem with the wire log display. I wonder if you set the charset in the Content-Type header prior to executing the post method?
<http://jakarta.apache.org/commons/httpclient/charencodings.html> Oleg -----Original Message----- From: Geir H. Pettersen [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 31, 2004 10:57 To: [EMAIL PROTECTED] Subject: The httpclient.wire log. Hi, I have been using the commons httpclient successfully since rc1. Great work guys! This is the best client that I ever have used in java. The httpclient.wire log is fantastic, but there is something there that bothers me a bit. Before the characters are written to log, they are decoded with "US-ASCII" (or the default character set if that fails). The problem with this is if you try to debug http traces with special character you will actually lose information on what is actually sent. My example is: I am having some encoding problems with my client, and I want to check exactly what bytes I am sending. I am sending the three Norwegian characters (1)æ (2)ø and (3)å. (ae together, o with a slash and a with a ring over). (1) is encoded in UTF-8 as 0xc3 0xa6 (2) is encoded in UTF-8 as 0xc3 0xb8 (3) is encodes in UTF-8 as 0xc3 0xa5 The problem is when I try to POST these three characters. It is logged as: "[0xfffd][0xfffd][0xfffd][0xfffd][0xfffd][0xfffd]" (but actually that is not what is sent) I want the log to be: "[0xc3][0xa6][0xc3][0xb8][0xc3][0xa5]" A fix for this would be to remove the encoded reader from: Wire.java : ----------------- ... // Reader reader = null; // try { // reader = new InputStreamReader(instream, "US-ASCII"); // } catch (UnsupportedEncodingException e) { // reader = new InputStreamReader(instream); // } StringBuffer buffer = new StringBuffer(); int ch; // while ((ch = reader.read()) != -1) { while ((ch = instream.read()) != -1) { ... ----------------- Notice that the method now no longer throws an IOException. Attached is my suggested changes in Wire.java. I did not remove the "throws IOException" from the method signature, since this may have other consequences. Regards, Geir H. Pettersen Cellus/Masp Technology AS *************************************************************************************************** The information in this email is confidential and may be legally privileged. Access to this email by anyone other than the intended addressee is unauthorized. If you are not the intended recipient of this message, any review, disclosure, copying, distribution, retention, or any action taken or omitted to be taken in reliance on it is prohibited and may be unlawful. If you are not the intended recipient, please reply to or forward a copy of this message to the sender and delete the message, any attachments, and any copies thereof from your system. *************************************************************************************************** --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]