This discussion is archived
2 Replies Latest reply: Oct 19, 2012 4:04 PM by Joe Huang RSS

UTF-8 Encoding in RestServiceAdapter - problems with german mutated vowels

924371 Newbie
Currently Being Moderated
Hello Team!
We've been looking into a problem with character encoding today and now came to the conclusion that it must be an internal error.

We used your RestServiceAdapter to receive a JSON object from our REST Service (GET).
Now we saw that in our UI, there are no mutated vowels shown, which are common in the German language. So instead of "Frühstück" or "Müsli" it showed "Fr%1/4hst%1/4ck".
I started looking into the code, checked out the decoder but there it showed the same problems.
So I looked at the string that is returned by the restServiceAdapter.send() method. => still the same problem

RestServiceAdapter restServiceAdapter = Model.createRestServiceAdapter();
restServiceAdapter.clearRequestProperties();
restServiceAdapter.setConnectionName("SteakMobileService");
restServiceAdapter.setRequestType(RestServiceAdapter.REQUEST_TYPE_GET);
restServiceAdapter.setRetryLimit(0);
restServiceAdapter.setRequestURI("Tagesgerichte/" datum + "/"); // "datum" is a string representing a date in the format yyyy-MM-dd+
restServiceAdapter.addRequestProperty("Accept", "application/json; charset=UTF-8");
restServiceAdapter.addRequestProperty("Content-Type", "application/json; charset=UTF-8");

String response = "";
+// Execute SEND and RECEIVE operation+
+try {+
response = restServiceAdapter.send("");
+}+
+//....+

Here, the "response" String already contains the broken letters. However, I used a couple of package analyzing tools as well as your integrated http analyzer to verify, that the service does send the correct UTF-8 encoded letters. So the only solution is the restServiceAdapter.send("") method.


Here are two screenshots:


http://img24.imageshack.us/img24/1967/httpanalyzerss.png
http://img706.imageshack.us/img706/4020/iosss.png

Of course, there are several steps between the response String and the UI shown on the Screenshot. However, the debugger already showed the lack of mutated vowels in the said string.

Just wanted to let you lucky americans without any weird vowels like that know that europe is having problems ;)

Kind regards,
Pascal

EDIT:
Note what happens when I set encoding from UTF-8 to cp1252 in the http analyzer:

http://img526.imageshack.us/img526/6710/httpanalyzer2ss.png

The wrong encoding is the same as is seen in the UI.. I guess there must be something set in the Adapter, that causes this.

Edited by: Pascal B on 16.07.2012 05:57

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points