rcube_charset

Character sets conversion functionality

package

Framework

subpackage

Core

author

Thomas Bruederli

author

Aleksander Machniak

author

Edmund Grimley Evans

Methods

Catch an error and throw an exception.

error_handler($errno, $errstr) 
static

Arguments

$errno

$errstr

Parse and validate charset name string (see #1485758).

parse_charset(string $input) : string
static

Sometimes charset string is malformed, there are also charset aliases but we need strict names for charset conversion (specially utf8 class)

Arguments

$input

string

Input charset name

Response

string

The validated charset name

Convert a string from one charset to another.

convert($str, $from, $to = null) : string
static

Uses mbstring and iconv functions if possible

Arguments

$str

$from

$to

Response

string

Converted string

Converts string from standard UTF-7 (RFC 2152) to UTF-8.

utf7_to_utf8($str) : string
static

Arguments

$str

Response

string

Converted string (UTF-8)

Converts string from UTF-16 to UTF-8 (helper for utf-7 to utf-8 conversion)

utf16_to_utf8($str) : string
static

Arguments

$str

Response

string

The converted string

Convert the data ($str) from RFC 2060's UTF-7 to UTF-8.

utf7imap_to_utf8(string $str) : string
static

If input data is invalid, return the original input string. RFC 2060 obviously intends the encoding to be unique (see point 5 in section 5.1.3), so we reject any non-canonical form, such as &ACY- (instead of &-) or &AMA-&AMA- (instead of &AMAAwA-).

Translated from C to PHP by Thomas Bruederli

Arguments

$str

string

Input string (UTF7-IMAP)

Response

string

Output string (UTF-8)

Convert the data ($str) from UTF-8 to RFC 2060's UTF-7.

utf8_to_utf7imap(string $str) : string
static

Unicode characters above U+FFFF are replaced by U+FFFE. If input data is invalid, return an empty string.

Translated from C to PHP by Thomas Bruederli

Arguments

$str

string

Input string (UTF-8)

Response

string

Output string (UTF7-IMAP)

A method to guess character set of a string.

detect(string $string, string $failover = null, string $language = null) : string
static

Arguments

$string

string

String

$failover

string

Default result for failover

$language

string

User language

Response

string

Charset name

Removes non-unicode characters from input.

clean(mixed $input) : mixed
static

Arguments

$input

mixed

String or array.

Response

mixed

String or array

Properties

aliases

aliases : 
static