Skip to content Skip to sidebar Skip to footer

Special Characters With Ksoap

I'm using KSOAP2 to invoke a web service. I am getting a response, but the special characters within that response aren't shown properly. How can I change that? EDIT: Following cod

Solution 1:

I found out that the encoding wasn't UTF-8, but ISO_8859_1. I converted the ISO_8859_1-encoded inputstream to UTF-8, and now everything is displayed the way it should.

Solution 2:

Old question but if I could help anyone I post my solution.

Similar issue. I searched the server logs and saw my request was ISO-8859-1-encoded, so the server response had this charset too. My solution was override ksoap API. In HttpTransportSE class you put in your question, in the method call, I changed the line:

connection.setRequestProperty("Content-Type", "text/xml");

I wanted my request was UTF-8-encoded, so I added:

connection.setRequestProperty("Content-Type", "text/xml;charset=utf-8");

Now, I send a UTF-8 request, and get an UTF-8 response.

Hope this helps.

Solution 3:

i have a similar issue when i am trying to send Chinese character to php server and the server get ???, i found it's a bug of ksoap, please read enter link description here for detail. this bug is fixed in ksoap2.6.

Post a Comment for "Special Characters With Ksoap"