Viewed   237 times

I have a problem related to this question. I have a web service (also using php) that returns some names. When any of them contains Swedish characters (å, ä or ö) and probably others as well i get a soapfault (looks like we got no XML document). I can however see the full (correct afaik) response using $soapcalo->__getLastResponse().

How do I handle the special characters? I have tried adding the encoding attribute (utf-8) on both client and server but without success.

Edit: Excerpt of the soap reply:

<?xml version="1.0" encoding="UTF-8"?>
 <SOAP-ENV:Envelope xmlns:SOAP-ENV="" xmlns:ns1="...">




Ok everyone - problem finally solved, thought I'd post it here for anyone else with similair problems. As it turns out, the problem occured earlier in the process.

The content of the SOAP reply was generated building the structure with a DomDocument. Later that was saved with the saveHTML function. As it turns out, that function adds some HTML encodings which breaks the soap decoding on the client.

When instead using the saveXML function the reply gets through successfully (also when adding tags and other strange stuff) and is also decoded to the correct strings by the soap client.

I hope this is the end of it, but you never know :)

Thanks for all the help and +1 on those helpful to checking the right places.


Thursday, December 1, 2022


$mail->CharSet = 'UTF-8';

instead of

$mail->CharSet = "utf8";

Monday, September 12, 2022

Replacing & with &amp; shouldn't break the url. Did you left out the ;?

Better solution is you should wrap that in a CDATA tag:

<![CDATA[,more+url;data ]]>

Which tells the XML parser to treat it as text and not parse the &.

Friday, August 5, 2022

Apparently, I forgot to set the StringEntity's charset to UTF-8. These lines did the trick:

    httpPut.setEntity(new StringEntity(body, HTTP.UTF_8));
    httpPost.setEntity(new StringEntity(body, HTTP.UTF_8));

So, there are at least two levels to set the charset in the Android client when sending an http post with non-ascii characters.

  1. The rest client itself itself
  2. The StringEntity

UPDATE: As Samuel pointed out in the comments, the modern way to do it is to use a ContentType, like so:

    final StringEntity se = new StringEntity(body, ContentType.APPLICATION_JSON);
Sunday, November 6, 2022

Check your database connection, make sure the sybase_connect connects with UTF-8 as charset. See

From the comment that you are using ODBC to connect: There seems to be an issue with PHP/ODBC and UTF8. Some suggestions are mentioned in this thread: Php/ODBC encoding problem

Sunday, September 4, 2022
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :