Home  >  Article  >  Backend Development  >  Solution to garbled characters when NuSOAP calls Web Service: _PHP Tutorial

Solution to garbled characters when NuSOAP calls Web Service: _PHP Tutorial

WBOY
WBOYOriginal
2016-07-20 11:10:19877browse

In fact, friends who have turned on the debugging function, I believe they will find that $client->response returns the correct result, why $result = $client->call($action, array('parameters' => $param)); But it's garbled code?

After studying the NuSOAP code, we will find that when xml_encoding is set to UTF-8, NuSOAP will detect the setting of decode_utf8. If it is true, the utf8_decode function in PHP will be executed, and NuSOAP defaults to true, so we need Settings:

The code is as follows
 代码如下 复制代码

$client->soap_defencoding = 'utf-8';
$client->decode_utf8 = false;
$client->xml_encoding = 'utf-8';

Copy code
$client->soap_defencoding = 'utf-8';
$client->decode_utf8 = false;
$client->xml_encoding = 'utf-8 ';

http://www.bkjia.com/PHPjc/444726.htmlwww.bkjia.comtrue
http: //www.bkjia.com/PHPjc/444726.html
TechArticle
In fact, friends who have turned on the debugging function, I believe they will find that $client->response returns the correct result. , why $result = $client->call($action, array('parameters' => $pa...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn