Stanley.Goldman
Stanley.Goldman

Reputation: 4337

Using PHP's SoapClient to send UTF-16 Character to WCF Service

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?

Upvotes: 2

Views: 1778

Answers (1)

chuck
chuck

Reputation:

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

Upvotes: 1

Related Questions