JSONRPC 1.0.0

Charset
in package
uses LoggerAware

Tags
todo

implement an Interface

Table of Contents

Properties

$ecma262_iso88591_Entities  : mixed
$instance  : mixed

Methods

encodeEntities()  : string
Encode php strings to valid JSON unicode representation.
instance()  : Charset
This class is singleton for performance reasons.
knownCharsets()  : array<string|int, string>
__construct()  : mixed
Force usage as singleton.

Properties

$ecma262_iso88591_Entities

protected mixed $ecma262_iso88591_Entities = array()

$instance

protected static mixed $instance = null

Methods

encodeEntities()

Encode php strings to valid JSON unicode representation.

public encodeEntities(string $data[, string $srcEncoding = '' ][, string $destEncoding = '' ]) : string

All chars outside ASCII range are converted to \uXXXX for maximum portability by default.

Parameters
$data : string
$srcEncoding : string = ''

charset of source string, defaults to PhpXmlRpc::$xmlrpc_internalencoding

$destEncoding : string = ''

charset of the encoded string, defaults to ASCII for maximum interoperability

Tags
todo

make use of iconv when it is available and mbstring is not

todo

support aliases for charset names, eg ASCII, LATIN1, ISO-88591 (see f.e. polyfill-iconv for a list), but then take those into account as well in other methods, ie. isValidCharset)

todo

when converting to ASCII, allow to choose whether to escape the range 0-31,127 (non-print chars) or not

todo

allow picking different strategies to deal w. invalid chars? eg. source in latin-1 and chars 128-159

Return values
string

instance()

This class is singleton for performance reasons.

public static instance() : Charset
Tags
todo

can't we just make $xml_iso88591_Entities a static variable instead ?

Return values
Charset

knownCharsets()

public knownCharsets() : array<string|int, string>
Return values
array<string|int, string>

__construct()

Force usage as singleton.

protected __construct() : mixed

        
On this page

Search results