问题描述:

My PHP application is taking user input and sending it to a WCF Web Service.

Sometimes my users copy and paste from Word and get UTF-16 Characters into their message such as the "En Dash" \u2013

I get the following error when this occurs.

PHP Fatal error: SOAP-ERROR: Encoding:

string '\xe2...' is not a valid

utf-8 string in *** on line 31

I've tried setting the encoding option of the SoapClient constructor to 'UTF-16'.

My request seems to work, but I notice the encoding on the xml header is still set to UTF-8.

Any ideas?

网友答案:

WCF works in UTF-8 only and word works in UTF-16 by default which explains why its lookling like UTF8

Try using mbstring to correct the issue

相关阅读:
Top