Home » Web Services » SOAP » Bug #9767
Problem sending string containg one or more of the following chars: ì è é ù à ò
Details
| Submitted | 2007-01-08 13:23 UTC |
|---|---|
| From | paolo dot mosna at gmail dot com |
| Assigned | yunosh |
| Status | Bogus |
| Package | SOAP |
| PHP Version | 4.4.2 |
| OS | Linux |
| Roadmaps | (Not assigned) |
Comments
[2007-01-08 13:23 UTC] paolo dot mosna at gmail dot com
Description:
------------
Using SOAP package to connect to a TCL implemented Web service, we found problems sending strings containing one or more of the following characters: ì è é ù à ò.
In order for the server side WS to correctly interpret strings with one or more of the aforementioned characters, the character should be encoded in the form &#xXX; where XX the hexadecimal representation for the given character.
PHP implementation just uses PHP function htmlspecialchars() to convert the string inside method _serializeValue() before writing it in the SOAP XML . Unfortunately this is not enough when processing characters such as: ì ò à ù è é.
To solve the problem we replaced the use of function htmlspecialchars() with the following one:
function _htmlnumericentities($str){
return preg_replace('/[^!-%\x27-;=?-~ ]/e', '"&#".ord("$0").chr(59)', utf8_decode($str));
}
First the string is decoded from utf8 and finally converted as required.
[2007-01-08 13:25 UTC] paolo dot mosna at gmail dot com
Changed summary