‪TYPO3CMS  9.5
Mso\IdnaConvert\UnicodeTranscoder Class Reference
Inheritance diagram for Mso\IdnaConvert\UnicodeTranscoder:
Mso\IdnaConvert\UnicodeTranscoderInterface

Static Public Member Functions

static mixed convert ($data, $from, $to, $safe_mode=false, $safe_char=0xFFFC)
 
static array utf8_ucs4array ($input)
 
static string ucs4array_utf8 ($input)
 
static utf7imap_ucs4array ($input)
 
static utf7_ucs4array ($input, $sc='+')
 
static ucs4array_utf7imap ($input)
 
static ucs4array_utf7 ($input, $sc='+')
 
static string ucs4array_ucs4 ($input)
 
static array ucs4_ucs4array ($input)
 

Static Protected Member Functions

static int byteLength ($string)
 

Static Private Attributes

static $mechs = array( 'ucs4', 'ucs4array', 'utf8', 'utf7', 'utf7imap' )
 
static $allow_overlong = false
 
static $safe_mode
 
static $safe_char
 

Detailed Description

Definition at line 19 of file UnicodeTranscoder.php.

Member Function Documentation

◆ byteLength()

static int Mso\IdnaConvert\UnicodeTranscoder::byteLength (   $string)
staticprotected

Gets the length of a string in bytes even if mbstring function overloading is turned on

Parameters
string$string‪the string for which to get the length.
Returns
‪int the length of the string in bytes.

Definition at line 346 of file UnicodeTranscoder.php.

Referenced by Mso\IdnaConvert\UnicodeTranscoder\ucs4_ucs4array(), Mso\IdnaConvert\UnicodeTranscoder\utf7_ucs4array(), and Mso\IdnaConvert\UnicodeTranscoder\utf8_ucs4array().

◆ convert()

static mixed Mso\IdnaConvert\UnicodeTranscoder::convert (   $data,
  $from,
  $to,
  $safe_mode = false,
  $safe_char = 0xFFFC 
)
static

The actual conversion routine

Parameters
mixed$data‪The data to convert, usually a string, array when converting from UCS-4 array
string$from‪Original encoding of the data
string$to‪Target encoding of the data
bool$safe_mode‪SafeMode tries to correct invalid codepoints
int$safe_char‪Unicode Codepoint as placeholder for all otherwise broken characters
Returns
‪mixed False on failure, String or array on success, depending on target encoding
Exceptions

Implements Mso\IdnaConvert\UnicodeTranscoderInterface.

Definition at line 40 of file UnicodeTranscoder.php.

References Mso\IdnaConvert\UnicodeTranscoder\$safe_char, and Mso\IdnaConvert\UnicodeTranscoder\$safe_mode.

Referenced by Mso\IdnaConvert\IdnaConvert\decode(), and Mso\IdnaConvert\IdnaConvert\encode().

◆ ucs4_ucs4array()

static array Mso\IdnaConvert\UnicodeTranscoder::ucs4_ucs4array (   $input)
static

Convert UCS-4 string (LE ar the moment) into UCS-4 array

Parameters
$input‪string UCS-4 LE string
Returns
‪array

Implements Mso\IdnaConvert\UnicodeTranscoderInterface.

Definition at line 314 of file UnicodeTranscoder.php.

References $output, and Mso\IdnaConvert\UnicodeTranscoder\byteLength().

◆ ucs4array_ucs4()

static string Mso\IdnaConvert\UnicodeTranscoder::ucs4array_ucs4 (   $input)
static

Convert UCS-4 array into UCS-4 string (Little Endian at the moment)

Parameters
$input‪array UCS-4 code points
Returns
‪string

Implements Mso\IdnaConvert\UnicodeTranscoderInterface.

Definition at line 299 of file UnicodeTranscoder.php.

References $output.

◆ ucs4array_utf7()

static Mso\IdnaConvert\UnicodeTranscoder::ucs4array_utf7 (   $input,
  $sc = '+' 
)
static

Implements Mso\IdnaConvert\UnicodeTranscoderInterface.

Definition at line 256 of file UnicodeTranscoder.php.

References $output.

◆ ucs4array_utf7imap()

static Mso\IdnaConvert\UnicodeTranscoder::ucs4array_utf7imap (   $input)
static

Implements Mso\IdnaConvert\UnicodeTranscoderInterface.

Definition at line 251 of file UnicodeTranscoder.php.

◆ ucs4array_utf8()

static string Mso\IdnaConvert\UnicodeTranscoder::ucs4array_utf8 (   $input)
static

Convert UCS-4 arary into UTF-8 string See utf8_ucs4array() for details

Parameters
$input‪array Array of UCS-4 codepoints
Returns
‪string

Implements Mso\IdnaConvert\UnicodeTranscoderInterface.

Definition at line 166 of file UnicodeTranscoder.php.

References $output, and Mso\IdnaConvert\UnicodeTranscoder\$safe_char.

Referenced by Mso\IdnaConvert\Punycode\decode().

◆ utf7_ucs4array()

static Mso\IdnaConvert\UnicodeTranscoder::utf7_ucs4array (   $input,
  $sc = '+' 
)
static

◆ utf7imap_ucs4array()

static Mso\IdnaConvert\UnicodeTranscoder::utf7imap_ucs4array (   $input)
static

◆ utf8_ucs4array()

static array Mso\IdnaConvert\UnicodeTranscoder::utf8_ucs4array (   $input)
static

This converts an UTF-8 encoded string to its UCS-4 representation

Parameters
string$input‪The UTF-8 string to convert
Returns
‪array Array of 32bit values representing each codepoint
Exceptions

Implements Mso\IdnaConvert\UnicodeTranscoderInterface.

Definition at line 73 of file UnicodeTranscoder.php.

References $output, Mso\IdnaConvert\UnicodeTranscoder\$safe_char, and Mso\IdnaConvert\UnicodeTranscoder\byteLength().

Referenced by Mso\IdnaConvert\Punycode\encode().

Member Data Documentation

◆ $allow_overlong

Mso\IdnaConvert\UnicodeTranscoder::$allow_overlong = false
staticprivate

Definition at line 24 of file UnicodeTranscoder.php.

◆ $mechs

Mso\IdnaConvert\UnicodeTranscoder::$mechs = array( 'ucs4', 'ucs4array', 'utf8', 'utf7', 'utf7imap' )
staticprivate

Definition at line 21 of file UnicodeTranscoder.php.

◆ $safe_char

Mso\IdnaConvert\UnicodeTranscoder::$safe_char
staticprivate

◆ $safe_mode

Mso\IdnaConvert\UnicodeTranscoder::$safe_mode
staticprivate

Definition at line 25 of file UnicodeTranscoder.php.

Referenced by Mso\IdnaConvert\UnicodeTranscoder\convert().