Open Monograph Press
3.3.0
|
Public Member Functions | |
encodeEntities ($data, $srcEncoding='', $destEncoding='') | |
getEntities ($charset) | |
isValidCharset ($encoding, $validList) | |
Static Public Member Functions | |
static | instance () |
Protected Attributes | |
$charset_supersets | |
$xml_iso88591_Entities = array("in" => array(), "out" => array()) | |
Static Protected Attributes | |
static | $instance = null |
Definition at line 7 of file Charset.php.
PhpXmlRpc\Helper\Charset::encodeEntities | ( | $data, | |
$srcEncoding = '' , |
|||
$destEncoding = '' |
|||
) |
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.
do a bit of basic benchmarking (strtr vs. str_replace)
make usage of iconv() or recode_string() or mb_string() where available
string | $data | |
string | $srcEncoding | |
string | $destEncoding |
Definition at line 90 of file Charset.php.
References PhpXmlRpc\PhpXmlRpc\$xmlrpc_internalencoding.
PhpXmlRpc\Helper\Charset::getEntities | ( | $charset | ) |
Used only for backwards compatibility
string | $charset |
Definition at line 251 of file Charset.php.
References PhpXmlRpc\Helper\Charset\$xml_iso88591_Entities.
|
static |
This class is singleton for performance reasons.
Definition at line 43 of file Charset.php.
References PhpXmlRpc\Helper\Charset\$instance.
Referenced by PhpXmlRpc\PhpXmlRpc\exportGlobals().
PhpXmlRpc\Helper\Charset::isValidCharset | ( | $encoding, | |
$validList | |||
) |
Checks if a given charset encoding is present in a list of encodings or if it is a valid subset of any encoding in the list.
string | $encoding | charset to be tested |
string | array | $validList | comma separated list of valid charsets (or array of charsets) |
Definition at line 221 of file Charset.php.
|
protected |
Definition at line 28 of file Charset.php.
|
staticprotected |
Definition at line 36 of file Charset.php.
Referenced by PhpXmlRpc\Helper\Charset\instance().
|
protected |
Definition at line 10 of file Charset.php.
Referenced by PhpXmlRpc\Helper\Charset\getEntities().