sahaya / rest-assured

Automatically exported from code.google.com/p/rest-assured
0 stars 0 forks source link

Can't set defaultCharset for the response #240

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use an IDE with non UTF-8 encoding
2. Receive an UTF-8 response with special chars from your API
3. Use Response.asString() on it

-> Obviously there are encoding problems.
The Response.asString() can't take a Charset as parameter and there is no way 
to specify the default charset used for byte/stream to String conversions in 
RestAssuredConfig, except the system property "-Dfile.encoding"

I would expect in this method:
com.jayway.restassured.internal.RestAssuredResponseImpl#findCharset
That we can set a default body decoding charset in RestAssuredConfig, or that 
we can use Response.asString("UTF-8") for exemple (or both)

Original issue reported on code.google.com by lorber.s...@gmail.com on 30 May 2013 at 2:41

GoogleCodeExporter commented 9 years ago
Can't you use DecoderConfig and specify a defaultContentCharset? What version 
of RA are you using?

Original comment by johan.ha...@gmail.com on 3 Jun 2013 at 6:48

GoogleCodeExporter commented 9 years ago
You are right it works fine! I though I tested that but finally noticed that 
the code setting the Decoder wasn't called in my test!

1.8

Thanks

Original comment by lorber.s...@gmail.com on 3 Jun 2013 at 8:11

GoogleCodeExporter commented 9 years ago
Great!

Original comment by johan.ha...@gmail.com on 3 Jun 2013 at 8:19