SOAP-ERROR:编码:string ...不是一个有效的utf-8字符串 [英] SOAP-ERROR: Encoding: string ... is not a valid utf-8 string
本文介绍了SOAP-ERROR:编码:string ...不是一个有效的utf-8字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Jaime Torres Bodet#322-A Loma de SantaMaría上校
webservice返回以下错误:
< SOAP-ENV:Envelope xmlns :SOAP-ENV = http://schemas.xmlsoap.org/soap/envelope/ >
< SOAP-ENV:Body>
< SOAP-ENV:Fault>
< faultcode> SOAP-ENV:服务器< / faultcode>
< faultstring> SOAP-ERROR:Encoding:string'Jaime Torres Bodet#322-A Colon Lomas de Santa Mar \xc3 ...'不是有效的utf-8字符串< / faultstring>
< / SOAP-ENV:Fault>
< / SOAP-ENV:Body>
< / SOAP-ENV:Envelope>
我该怎么解决这个问题?
谢谢
解决方案
今天遇到同样的问题 - 导致该问题的代码是:
$ request-> Text = substr($ text,0,40);
将substr更改为mb_substr似乎可以解决问题:
$ pre>
$ request-> Test = mb_substr($ text,0,40,'utf8');
Hi I have a web service built using the Zend Framework. One of the methods is intended to send details about an order. I ran into some encoding issue. One of the values being returned contains the following:
Jaime Torres Bodet #322-A Col. Lomas de Santa María
The webservice is returning the following fault:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>SOAP-ERROR: Encoding: string 'Jaime Torres Bodet #322-A Col. Lomas de Santa Mar\xc3...' is not a valid utf-8 string</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
How should I go about this problem?
Thanks
解决方案
Today I run into same problem - the code which caused that problem was:
$request->Text = substr($text, 0, 40);
changing substr to mb_substr seems to solve the issue:
$request->Test = mb_substr($text, 0, 40, 'utf8');
这篇关于SOAP-ERROR:编码:string ...不是一个有效的utf-8字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文