X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=src%2FHelper%2FCharset.php;h=0ec7de4f74d38e1f9f1bf6c3b83441de8bf350f1;hb=f4978078febfc4289bb4f45db6ca3f9e6c8c4f94;hp=b934041467975b642acde6bc6d15876c6231463d;hpb=58ef35a678d6b26c919245ff83e33e37135bae12;p=plcapi.git diff --git a/src/Helper/Charset.php b/src/Helper/Charset.php index b934041..0ec7de4 100644 --- a/src/Helper/Charset.php +++ b/src/Helper/Charset.php @@ -68,15 +68,14 @@ class Charset } /** - * Convert a string to the correct XML representation in a target charset - * To help correct communication of non-ascii chars inside strings, regardless - * of the charset used when sending requests, parsing them, sending responses - * and parsing responses, an option is to convert all non-ascii chars present in the message - * into their equivalent 'charset entity'. Charset entities enumerated this way - * are independent of the charset encoding used to transmit them, and all XML - * parsers are bound to understand them. - * Note that in the std case we are not sending a charset encoding mime type - * along with http headers, so we are bound by RFC 3023 to emit strict us-ascii. + * Convert a string to the correct XML representation in a target charset. + * + * To help correct communication of non-ascii chars inside strings, regardless of the charset used when sending + * requests, parsing them, sending responses and parsing responses, an option is to convert all non-ascii chars + * present in the message into their equivalent 'charset entity'. Charset entities enumerated this way are + * independent of the charset encoding used to transmit them, and all XML parsers are bound to understand them. + * Note that in the std case we are not sending a charset encoding mime type along with http headers, so we are + * bound by RFC 3023 to emit strict us-ascii. * * @todo do a bit of basic benchmarking (strtr vs. str_replace) * @todo make usage of iconv() or recode_string() or mb_string() where available @@ -110,7 +109,7 @@ class Charset case 'US-ASCII_': case 'US-ASCII_ISO-8859-1': case 'UTF-8_UTF-8': - //case 'CP1252_CP1252': + //case 'CP1252_CP1252': $escapedData = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $data); break; case 'UTF-8_': @@ -203,7 +202,7 @@ class Charset */ default: $escapedData = ''; - error_log("Converting from $srcEncoding to $destEncoding: not supported..."); + error_log('XML-RPC: ' . __METHOD__ . ": Converting from $srcEncoding to $destEncoding: not supported..."); } return $escapedData;