Utility class for handling strings of different character encodings using available PHP extensions.

Declared abstract, as we have no need for instantiation.

 Methods

Get registered wrapper classes

getRegisteredWrappers() : string[]

Returns

string[]

Get a list of all known single-byte character encodings

getSingleByteEncodings() : string[]

Returns

string[]

Get the first string wrapper supporting the given character encoding and supports to convert into the given convert encoding.

getWrapper(string $encoding, string | null $convertEncoding) : \Zend\Stdlib\StringWrapper\StringWrapperInterface

Parameters

$encoding

string

Character encoding to support

$convertEncoding

stringnull

OPTIONAL character encoding to convert in

Exceptions

\Zend\Stdlib\Exception\RuntimeException If no wrapper supports given character encodings

Returns

Is PCRE compiled with Unicode support?

hasPcreUnicodeSupport() : bool

Returns

bool

Check if a given encoding is a known single-byte character encoding

isSingleByteEncoding(string $encoding) : boolean

Parameters

$encoding

string

Returns

boolean

Check if a given string is valid UTF-8 encoded

isValidUtf8(string $str) : boolean

Parameters

$str

string

Returns

boolean

Register a string wrapper class

registerWrapper(string $wrapper) : void

Parameters

$wrapper

string

Reset all registered wrappers so the default wrappers will be used

resetRegisteredWrappers() : void

Unregister a string wrapper class

unregisterWrapper(string $wrapper) : void

Parameters

$wrapper

string

 Properties

 

Is PCRE compiled with Unicode support?

$hasPcreUnicodeSupport : bool

 

A list of known single-byte character encodings (upper-case)

$singleByteEncodings : string[]

 

Ordered list of registered string wrapper instances

$wrapperRegistry : \Zend\Stdlib\StringWrapper\StringWrapperInterface[]