I have a PHP SOAP server (using nuSOAP) that I consume with a C#-based application.
When the C# application submits a request, the strings are UTF-8 encoded. I verified using a network sniffer that the byte sequences are valid UTF-8. However, when PHP gets then and I post them to the database or send them by email, it appears to be printed like standard ASCII, the UTF encoding bytes are treated as characters.
I have the same issue with the C# app receiving UTF-8 from the SOAP server. .NET interprets each byte as a CHAR instead of a BYTE. I had to write a small function that converts each CHAR to a BYTE and then converts that to a UTF-8 string and that's working perfectly.
The question is, what do I need to do on the PHP server side to correctly process the incoming SOAP requests as UTF-8 for MySQL and the mail()
function? I've tried utf8_encode()
and utf8_decode()
but those mangle the string even worse.