ctakahashi / rest-client

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

2.3.1 version still throws encoding exception #114

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. use rest client 2.3.1
2. return "Collect 1 AIR MILES® " as json string
3.

What is the expected output? What do you see instead?
should show this on view area

What version of the product are you using? On what operating system?
2.3.1

Please provide any additional information below.
if I remove "®" from my response then it works, seems it is unable to parse on 
view area

File not in supported encoding (UTF-8)
java.io.IOException: File not in supported encoding (UTF-8)
    at org.wiztools.restclient.Util.inputStream2String(Util.java:86)
    at org.wiztools.restclient.HTTPClientRequestExecuter.execute(HTTPClientRequestExecuter.java:312)
    at org.wiztools.restclient.ui.RESTView$25.run(RESTView.java:1003)
Caused by: java.nio.charset.MalformedInputException: Input length = 1
    at java.nio.charset.CoderResult.throwException(Unknown Source)
    at java.nio.charset.CharsetDecoder.decode(Unknown Source)
    at org.wiztools.restclient.Util.inputStream2String(Util.java:83)
    ... 2 more

Original issue reported on code.google.com by scorpiod...@gmail.com on 20 Jul 2010 at 7:27

GoogleCodeExporter commented 8 years ago
RESTClient uses the Content-Type header to parse the text in correct encoding. 
If this header is not sent, RESTClient defaults to UTF-8.

I believe in your case, the OS encoding is different from UTF-8. So try adding 
Content-Type header with 'charset' parameter.

Original comment by subwiz on 20 Jul 2010 at 11:12

GoogleCodeExporter commented 8 years ago
r476 makes the charset processing more lenient. Now when the charset detail is 
not available in the response header, by default the platform encoding is 
assumed.

Original comment by subwiz on 3 Sep 2010 at 9:15

GoogleCodeExporter commented 8 years ago
Marking as Fixed.

Original comment by subwiz on 30 Jan 2011 at 6:03