|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-10-06 07:11 UTC] flobee at gmail dot com
Description:
------------
request and Response are always set to utf-8 even when server and client are set to ISO-8859-1 :-(
the good: it's handled to be ISO-8859-1 or will throw a SoapFault.
Reproduce code:
---------------
$a =new SoapClient($wsdl, array('encoding'=>'ISO-8859-1');
$b=new SoapServer($wsdl , array('encoding'=>'ISO-8859-1'));
xml-Request : <?xml version="1.0" encoding="UTF-8"?>...
xml-Response: <?xml version="1.0" encoding="UTF-8"?>...
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 19:00:01 2025 UTC |
[server] theServerClass { function __construct() { } function set($in) { return array('code'=>'€€€'); } } $server = new SoapServer('a.wsdl',array('encoding'=>'ISO-8859-1')); $server->setClass('theServerClass'); $server->handle(); [client] $cli = new SoapClient('a.wsdl', array('encoding'=>'ISO-8859-1','soap_version'=> SOAP_1_2, 'trace'=> 1)); $result = $cli->set('somthing'); print_r($cli->__getLastResponse()); ... xml-Response: <?xml version="1.0" encoding="UTF-8"?> but IS ISO-8859-1 set encoding to utf-8 the "€" will throw a SoapFault.The utf-8 is hard coded in soap.c so it's not even configurable. [andy@ddcctdev02 soap]$ grep -n utf *.c php_encoding.c:763: soap_error1(E_ERROR, "Encoding: string '%s' is not a valid utf-8 string", str); php_encoding.c:768: soap_error1(E_ERROR, "Encoding: string '%s' is not a valid utf-8 string", str); php_http.c:443: smart_str_append_const(&soap_headers,"Content-Type: application/soap+xml; charset=utf-8"); php_http.c:451: smart_str_append_const(&soap_headers,"Content-Type: text/xml; charset=utf-8\r\n"); soap.c:1444: sapi_add_header("Content-Type: text/xml; charset=utf-8", sizeof("Content-Type: text/xml; charset=utf-8")-1, 1); soap.c:1460: sapi_add_header("Content-Type: text/xml; charset=utf-8", sizeof("Content-Type: text/xml; charset=utf-8"), 1); soap.c:1859: sapi_add_header("Content-Type: application/soap+xml; charset=utf-8", sizeof("Content-Type: application/soap+xml; charset=utf-8")-1, 1); soap.c:1861: sapi_add_header("Content-Type: text/xml; charset=utf-8", sizeof("Content-Type: text/xml; charset=utf-8")-1, 1); soap.c:1988: sapi_add_header("Content-Type: application/soap+xml; charset=utf-8", sizeof("Content-Type: application/soap+xml; charset=utf-8")-1, 1); soap.c:1990: sapi_add_header("Content-Type: text/xml; charset=utf-8", sizeof("Content-Type: text/xml; charset=utf-8")-1, 1); This is causing me major problems with 5.1.2 but it's still like that in 5.2.0