class UTF8Utils

UTF-8 Utilities

Constants

FFFD

The Unicode replacement character.

.

Methods

static 
countChars($string)

Count the number of characters in a string.

static 
convertToUTF8( string $data, string $encoding = 'UTF-8')

Convert data from the given encoding to UTF-8.

static  array
checkForIllegalCodepoints( string $data)

Checks for Unicode code points that are not valid in a document.

Details

at line line 48
static countChars($string)

Count the number of characters in a string.

UTF-8 aware. This will try (in order) iconv, MB, libxml, and finally a custom counter.

Parameters

$string

at line line 77
static convertToUTF8( string $data, string $encoding = 'UTF-8')

Convert data from the given encoding to UTF-8.

This has not yet been tested with charactersets other than UTF-8. It should work with ISO-8859-1/-13 and standard Latin Win charsets.

Parameters

string $data The data to convert.
string $encoding A valid encoding. Examples: http://www.php.net/manual/en/mbstring.supported-encodings.php

at line line 131
static array checkForIllegalCodepoints( string $data)

Checks for Unicode code points that are not valid in a document.

Parameters

string $data A string to analyze.

Return Value

array An array of (string) error messages produced by the scanning.