Parsing XML (encoding ISO-8859-1) with Retrofit2 and SimpleXmlConverter doesn't show correct characters
See original GitHub issueWe (@deen13 and myself) are using the SimpleXmlConverter and Retrofit in our project like this:
private final MealplanService service = new Retrofit.Builder()
.baseUrl("IP-ADDRESS")
.addConverterFactory(SimpleXmlConverterFactory.create())
.build()
.create(MealplanService.class);
@Override
public void fetch(DownloadFinished downloadFinished) {
Call<Mealplan> call = service.getMealplan();
call.enqueue(new Callback<Mealplan>() {
// handling the response with response.body()
});
}
The response from the server is ISO-8859-1 encoded (confirmed by sniffing the http traffic and response in the browser) but is interpreted as UTF-8 as all “ä, ö, ü” characters are displayed as “�, �, �”.
We’ve tried using an interceptor, cloning the SimpleXmlConverter class and manually setting the encoding to ISO-8859-1 (where we found out that the Response object is already messed up) and setting the header parameters manually but nothing seems to work.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Parsing XML (encoding ISO-8859-1) with Retrofit2 and ...
Parsing XML (encoding ISO-8859-1) with Retrofit2 and SimpleXmlConverter doesn't show correct characters in Android.
Read more >Parsing XML (encoding ISO-8859-1) with Retrofit2 ... - GitHub
Parsing XML (encoding ISO-8859-1) with Retrofit2 and SimpleXmlConverter doesn't show correct characters #2041.
Read more >XML encoding to iso88591 - webMethods
All, I want the encode the xml I sent with iso-8859-1. ... When you set this to true it will convert special characters...
Read more >Parsing XML using Retrofit2 in Kotlin - Ekaterina Temnogrudova
With inline set to true, it is determined that the elements of the Collection are inlined. That means, that they have no enclosing...
Read more >How to set the Xml Encoding ISO-8859-1 to Transformer or ...
Is there any way I can maintain the original Xml Encoding of ... Builder parser does not like this character when encoding is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sounds like a win-win.
On Tue, Dec 19, 2017 at 3:10 AM Florian notifications@github.com wrote:
Thanks for your question. This issue tracker is only for bug reports with test cases and feature requests. Please ask usage questions on Stack Overflow. https://stackoverflow.com/questions/tagged/retrofit