Zend Soap Server 返回 UTF-8 错误
我正在使用具有自动发现功能的 Zend Soap Server,这是我的代码:
$wsdl = new Zend_Soap_Autodiscover();
$wsdl->setClass('SoapParser');
if (isset($_GET['wsdl'])) {
$wsdl->handle();
} else {
$server = new Zend_Soap_Server('http://zzz.zz.zz/store.php?wsdl');
$server->setClass('SoapParser');
$server->setEncoding('UTF-8');
$server->setObject(new SoapParser());
$server->handle();
}
当我通过 SOAP 客户端调用某些方法时,我收到此错误:
SOAP-ENV:ServerSOAP-ERROR: Encoding: string '00127920110531 xxx zzz Dom 67 av Ren\ xe9...' 不是有效的 utf-8 字符串
“\xe9”是“é”...源表采用 UTF-8
如果我进行更改
$server->setEncoding('UTF-8');
,
$server->setEncoding('ISO-8859-1')
我不会收到错误,但字符串未正确解析,有奇怪的字符...
知道吗?
I'm using Zend Soap Server with autodiscover, this is my code:
$wsdl = new Zend_Soap_Autodiscover();
$wsdl->setClass('SoapParser');
if (isset($_GET['wsdl'])) {
$wsdl->handle();
} else {
$server = new Zend_Soap_Server('http://zzz.zz.zz/store.php?wsdl');
$server->setClass('SoapParser');
$server->setEncoding('UTF-8');
$server->setObject(new SoapParser());
$server->handle();
}
When I invoke some methods through a SOAP client, I receive this error:
SOAP-ENV:ServerSOAP-ERROR: Encoding: string '00127920110531 xxx zzz Dom 67 av Ren\xe9...' is not a valid utf-8 string
the "\xe9" is a "é"... source table is in UTF-8
if I change
$server->setEncoding('UTF-8');
in
$server->setEncoding('ISO-8859-1')
i don't receive the error but the strings aren't correctly parsed, there are stranges chars...
Any idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这不是你的服务器的问题,这是你的客户端的问题。
您的客户端正在提交
ISO-8859-1
字符串,您可以在提交之前尝试对数据进行utf8_encode()
处理。如果当客户端和服务器都使用相同的编码时您仍然看到奇怪的字符,那么您可能有一个混合了多种编码的源字符串。它是由单一来源构建的吗?它是否在某处正确显示?
This is not a problem with your server, this is a problem with your client.
Your client is submitting an
ISO-8859-1
string, you may try toutf8_encode()
the data prior to submitting it.If you still see weird chars when both the client and the server use the same encoding, then you might have a source string mixing several encodings. Is it built from a single source? Is it being displayed correctly somewhere?