I am programming a "SOAP Proxy" th开发者_Python百科at connects to a SOAP Server (Main Server) and is a SOAP Server itself. I am programing one Client too that will contact with this SOAP Proxy.
When the SOAP Client call a specific metodh from the SOAP Proxy I receive this error:
SOAP-ERROR: Encoding: string 'Pir\xe4...' is not a valid utf-8 string
I do not know in what language the Main Server is implemented. I am working with PHP in the Proxy Server and in the Client. The information comes from the Main Server and is a complex object.
I found a workaround to the problem. Adding this line before return the content in the Proxy Server eveithyng is ok:
$result = json_decode(utf8_encode(json_encode($result)));
But, i think this is quinte ninja function to do. There are a better way? Anyone found this kind of problem in the past? Or is something missing in my ideia?
I would say, it is ok to encode the return ? But more sexy is it to use the Zend Framework methods to encode it:
// could be set in bootstrap
Zend_Json::$useBuiltinEncoderDecoder = true;
// should be correct utf8
$result = Zend_Json::encode($result);
精彩评论