rcube_charset

Character sets conversion functionality

package

Framework

subpackage

Core

author

Thomas Bruederli roundcube@gmail.com

author

Aleksander Machniak alec@alec.pl

author

Edmund Grimley Evans edmundo@rano.org

Methods

Removes non-unicode characters from input.

clean(mixed $input) : mixed
static

Arguments

$input

mixed

String or array.

Response

mixed

String or array

Convert a string from one charset to another.

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

Uses mbstring and iconv functions if possible

Arguments

$str

string

Input string

$from

string

Suspected charset of the input string

$to

string

Target charset to convert to; defaults to RCUBE_CHARSET

Response

string

Converted string

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

Catch an error and throw an exception.

error_handler(integer $errno, string $errstr) 
static

Arguments

$errno

integer

Level of the error

$errstr

string

Error message

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

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

utf16_to_utf8(string $str) : string
static

Arguments

$str

string

Input string

Response

string

The converted string

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

utf7_to_utf8(string $str) : string
static

Arguments

$str

string

Input string (UTF-7)

Response

string

Converted string (UTF-8)

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 roundcube@gmail.com

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 roundcube@gmail.com

Arguments

$str

string

Input string (UTF-8)

Response

string

Output string (UTF7-IMAP)

Properties

aliases

aliases : 
static

Type(s)

Windows codepages

windows_codepages : array
static
var

Type(s)

array