Charset
in package
uses
DeprecationLogger
Tags
Table of Contents
Properties
- $charset_supersets : mixed
- $instance : Charset
- $xml_iso88591_Entities : mixed
Methods
- encodeEntities() : string
- Convert a string to the correct XML representation in a target charset.
- getEntities() : array<string|int, mixed>
- Used only for backwards compatibility (the .inc shims).
- instance() : Charset
- This class is singleton for performance reasons.
- isValidCharset() : bool
- 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.
- knownCharsets() : array<string|int, string>
- __construct() : mixed
- Force usage as singleton.
- buildConversionTable() : void
- logDeprecation() : mixed
- logDeprecationUnlessCalledBy() : void
Properties
$charset_supersets
protected
mixed
$charset_supersets
= array('US-ASCII' => array('ISO-8859-1', 'ISO-8859-2', 'ISO-8859-3', 'ISO-8859-4', 'ISO-8859-5', 'ISO-8859-6', 'ISO-8859-7', 'ISO-8859-8', 'ISO-8859-9', 'ISO-8859-10', 'ISO-8859-11', 'ISO-8859-12', 'ISO-8859-13', 'ISO-8859-14', 'ISO-8859-15', 'UTF-8', 'EUC-JP', 'EUC-', 'EUC-KR', 'EUC-CN'))
$instance
protected
static Charset
$instance
= null
$xml_iso88591_Entities
protected
mixed
$xml_iso88591_Entities
= array("in" => array(), "out" => array())
Methods
encodeEntities()
Convert a string to the correct XML representation in a target charset.
public
encodeEntities(string $data[, string $srcEncoding = '' ][, string $destEncoding = '' ]) : string
This involves:
- character transformation for all characters which have a different representation in source and dest charsets
- using 'charset entity' representation for all characters which are outside the 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 when not sending a charset encoding mime type along with http headers, we are bound by RFC 3023 to emit strict us-ascii for 'text/xml' payloads (but we should review RFC 7303, which seems to have changed the rules...)
Parameters
- $data : string
- $srcEncoding : string = ''
- $destEncoding : string = ''
Tags
Return values
stringgetEntities()
Used only for backwards compatibility (the .inc shims).
public
getEntities(string $charset) : array<string|int, mixed>
Parameters
- $charset : string
Tags
Return values
array<string|int, mixed>instance()
This class is singleton for performance reasons.
public
static instance() : Charset
Tags
Return values
CharsetisValidCharset()
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.
public
isValidCharset(string $encoding, string|array<string|int, mixed> $validList) : bool
kept around for BC, as it is not in use by the lib
Parameters
- $encoding : string
-
charset to be tested
- $validList : string|array<string|int, mixed>
-
comma separated list of valid charsets (or array of charsets)
Return values
boolknownCharsets()
public
knownCharsets() : array<string|int, string>
Return values
array<string|int, string>__construct()
Force usage as singleton.
protected
__construct() : mixed
buildConversionTable()
protected
buildConversionTable(string $tableName) : void
Parameters
- $tableName : string
Tags
logDeprecation()
protected
logDeprecation(mixed $message) : mixed
Parameters
- $message : mixed
logDeprecationUnlessCalledBy()
protected
logDeprecationUnlessCalledBy(string $expectedCaller) : void
Parameters
- $expectedCaller : string
-
atm only the method name is supported