radman38654 / rest-client

Automatically exported from code.google.com/p/rest-client
Apache License 2.0
0 stars 0 forks source link

Unicode string POST/PUT broken #74

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When POST/PUT unicode string, restclient breaks the unicode characters.

When I POST/PUT the following unicode text(Content-Type: application/
json;charset=utf-8),

{
  "person" : {
    "name" : "이름",
    "email" : "aaron@example.com",

  }
}

The server gets,
{
  "person" : {
    "name" : "??",
    "email" : "aaron@example.com",

  }
}

"이름"is unicode character.

I tested this with curl( http://curl.haxx.se/ ), and it works fine.

I added an correct output image.

Original issue reported on code.google.com by kwon3...@gmail.com on 5 Nov 2008 at 2:10

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for reporting this. I am looking into it.

Original comment by subwiz on 6 Nov 2008 at 1:46

GoogleCodeExporter commented 8 years ago
Did a preliminary study. This is surprising because I am doing just getText() 
and
setText()--which does not warrent such issues. Anyways, the problem could be in:

* JSyntaxPane editor component changing the characters
* HTTPClient library modifying the character (very unlikely)

I will do a more thorough study today evening.

Original comment by subwiz on 6 Nov 2008 at 11:20

GoogleCodeExporter commented 8 years ago
Did a basic test with TCPMon ( http://ws.apache.org/commons/tcpmon/ ). The 
request
body string itself is corrupted. The issue could be in:

http://code.google.com/p/rest-client/source/browse/trunk/src/main/java/org/wizto
ols/restclient/HTTPRequestThread.java

I doubt the StringEntity API class of HTTPClient which I am using as:

StringEntity entity = new StringEntity(bean.getBody());

Original comment by subwiz on 6 Nov 2008 at 11:44

GoogleCodeExporter commented 8 years ago
(Self-reminder:) When home, I should test with:

http://hc.apache.org/httpcomponents-core/httpcore/apidocs/org/apache/http/entity
/ByteArrayEntity.html

Original comment by subwiz on 6 Nov 2008 at 11:45

GoogleCodeExporter commented 8 years ago
Revision 330 has the fix.

Original comment by subwiz on 6 Nov 2008 at 4:39