ID:               47273
 Updated by:       tony2...@php.net
 Reported By:      shaselboeck at m-s dot de
-Status:           Open
+Status:           Assigned
 Bug Type:         SOAP related
 Operating System: Linux
 PHP Version:      5.2.8
-Assigned To:      
+Assigned To:      dmitry


Previous Comments:
------------------------------------------------------------------------

[2009-02-02 10:16:38] shaselboeck at m-s dot de

Description:
------------
Setting up an SoapServer with another encoding as UTF-8 - for example
Cp1252 - SoapServer->fault() will not correct encode the message.

By throwing a SoapFault with an message, the encoding will be done
correctly, but SoapServer->fault() does not.

To suppress error, I run an internal encoding.
mb_convert_encoding($string, 'UTF-8', $this->getEncoding());

Reproduce code:
---------------
All code listed here is part of a complex class hierarchy in
combination with the Zend Framework.

--------------------------------------------
SERVER-CODE
----------------------- ---------------------
$server = new SoapServer('http://xxx.de/?wsdl', array('encoding' =>
'Cp1252'));
$server->setClass('SoapFaultTest');

try {
    $server->handle();
}
catch (Exception $e) {
    $this->fault('Sender', $e->getMessage());
}

--------------------------------------------
CLIENT-CODE
--------------------------------------------
try {
    $client = new SoapClient('http://xxx.de/?wsdl', array('encoding' =>
'Cp1252'));
    echo $client->test();
}
catch (SoapFault $fault) {
    echo 'Error: ' . $fault->getMessage();
}

--------------------------------------------
SERVICE-CLASS SoapFaultTest
--------------------------------------------
class SoapFaultTest
{
    public function test() {
        throw new Exception('Exception with some special chars: Äßö');
    }
}

Expected result:
----------------
Exception with some special chars: Äßö

Actual result:
--------------
SOAP-ERROR: Encoding: string 'Exception with some special chars:
\xc4...' is not a valid utf-8 string


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=47273&edit=1

Reply via email to