#28969 [Com]: Wrong data encoding of special characters

From: Date: Fri, 13 Aug 2004 06:52:33 +0000
Subject: #28969 [Com]: Wrong data encoding of special characters
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-64526@lists.php.net to get a copy of this message
ID: 28969 Comment by: bryanguo at 21cn dot com Reported By: ba at esoft dot dk Status: Closed Bug Type: SOAP related Operating System: Linux 2.6.7-gentoo-r3 PHP Version: 5.0.0RC3 Assigned To: dmitry New Comment: Hi, I tested the "encoding" option, but it doesn't work yet. In my case, I need to send/receive chinese characters in the data. So firstly I hope the SOAP data can encode with "gb2312": $SOAP = new SoapServer("test.wsdl",array('encoding'=>'gb2312')); Unfortunately, the return data is like below and "encoding" option is still 'UTF-8': HTTP/1.1 200 OK Date: Fri, 13 Aug 2004 06:42:12 GMT Server: Apache/2.0.48 (Unix) PHP/5.0.0 X-Powered-By: PHP/5.0.0 Set-Cookie: SCP_WS_SESSIONID=635131d75dc3b040f0d96e88518fe02c; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Content-Length: 639 Connection: close Content-Type: text/xml; charset="utf-8" <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://xxx" xmlns:ns2="http://xxx" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <ns1:FindDriversResponse> <FindDriversReturn SOAP-ENC:arrayType="ns2:Driver[0]" xsi:type="ns1:ArrayOf_tns1_Driver"/> </ns1:FindDriversResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope> What's the problem? Previous Comments: ------------------------------------------------------------------------ [2004-08-11 08:25:51] ba at esoft dot dk I will check it out.. sounds great! ------------------------------------------------------------------------ [2004-08-10 18:37:24] dmitry@php.net Fixed in CVS HEAD. By default ext/soap espect all string data in utf-8 encoding. Now it is possible to change internal encoding with "encoding" option. It is acceptable both by SoapClient and SoapServer. $SOAP = new SoapServer("test.wsdl", array('encoding'=>'ISO-8859-1'); ------------------------------------------------------------------------ [2004-06-30 09:38:43] ba at esoft dot dk Description: ------------ I'm using SOAP webservices and need to send special characters (danish letters in my case) in the data, it seems these letters break the SOAP parser. Previously we have used NuSOAP for webservices, and here special letters are encoded / decoded transparantly. Reproduce code: --------------- class testWebservice { function test() { return "æøå"; } } $SOAP = new SoapServer("test.wsdl"); $SOAP->setClass("testWebservice"); $SOAP->handle(); Expected result: ---------------- The returned string "æøå" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28969&edit=1

« previous php.bugs (#64526) next »