CharsetConverter
Class for conversion between charsets
Attributes
- #[Autoconfigure]
- $public: true
Table of Contents
Constants
- FALLBACK_CHAR = '?'
- Fallback character for chars with no equivalent.
Methods
- __construct() : mixed
- utf8_char_mapping() : string
- Maps all characters of a UTF-8 string.
- utf8_to_numberarray() : array<string|int, mixed>
- Converts all chars in the input UTF-8 string into integer numbers returned in an array.
- utf8CharToUnumber() : mixed
- Converts a UTF-8 Multibyte character to a UNICODE number Unit-tested by Kasper
Constants
FALLBACK_CHAR
Fallback character for chars with no equivalent.
protected
mixed
FALLBACK_CHAR
= '?'
Methods
__construct()
public
__construct(CharsetProvider $charsetProvider) : mixed
Parameters
- $charsetProvider : CharsetProvider
utf8_char_mapping()
Maps all characters of a UTF-8 string.
public
utf8_char_mapping(string $str) : string
Parameters
- $str : string
-
UTF-8 string
Return values
stringutf8_to_numberarray()
Converts all chars in the input UTF-8 string into integer numbers returned in an array.
public
utf8_to_numberarray(string $str) : array<string|int, mixed>
All HTML entities (like & or £ or { or 㽝) will be detected as characters. Also, instead of integer numbers the real UTF-8 char is returned.
Parameters
- $str : string
-
Input string, UTF-8
Return values
array<string|int, mixed> —Output array with the char numbers
utf8CharToUnumber()
Converts a UTF-8 Multibyte character to a UNICODE number Unit-tested by Kasper
public
utf8CharToUnumber(string $str[, bool $hex = false ]) : mixed
Parameters
- $str : string
-
UTF-8 multibyte character string
- $hex : bool = false
-
If set, then a hex. number is returned.
Return values
mixed —UNICODE integer