Class rcube_charset

Description

Character sets conversion functionality

Located in /rcube_charset.php (line 36)


	
			
Variable Summary
 static mixed $aliases
Method Summary
 static mixed clean (mixed $input)
 static string convert (string $str, string $from, [string $to = null])
 static string detect (string $string, [string $failover = ''])
 static void error_handler (int $errno, string $errstr)
 static string parse (string $input)
 static string utf7imap_to_utf8 (string $str)
 static string utf7_to_utf8 (string $str)
 static string utf8_to_utf7imap (string $str)
 static string utf16_to_utf8 (string $str)
Variables
static mixed $aliases = array(
'USASCII' => 'WINDOWS-1252',
'ANSIX31101983' => 'WINDOWS-1252',
'ANSIX341968' => 'WINDOWS-1252',
'UNKNOWN8BIT' => 'ISO-8859-15',
'UNKNOWN' => 'ISO-8859-15',
'USERDEFINED' => 'ISO-8859-15',
'KSC56011987' => 'EUC-KR',
'GB2312' => 'GBK',
'GB231280' => 'GBK',
'UNICODE' => 'UTF-8',
'UTF7IMAP' => 'UTF7-IMAP',
'TIS620' => 'WINDOWS-874',
'ISO88599' => 'WINDOWS-1254',
'ISO885911' => 'WINDOWS-874',
'MACROMAN' => 'MACINTOSH',
'77' => 'MAC',
'128' => 'SHIFT-JIS',
'129' => 'CP949',
'130' => 'CP1361',
'134' => 'GBK',
'136' => 'BIG5',
'161' => 'WINDOWS-1253',
'162' => 'WINDOWS-1254',
'163' => 'WINDOWS-1258',
'177' => 'WINDOWS-1255',
'178' => 'WINDOWS-1256',
'186' => 'WINDOWS-1257',
'204' => 'WINDOWS-1251',
'222' => 'WINDOWS-874',
'238' => 'WINDOWS-1250',
'MS950' => 'CP950',
'WINDOWS949' => 'UHC',
)
(line 39)
  • access: public
Methods
static clean (line 671)

Removes non-unicode characters from input.

  • return: String or array
  • access: public
mixed clean (mixed $input)
  • mixed $input: String or array.
static convert (line 178)

Convert a string from one charset to another.

Uses mbstring and iconv functions if possible

  • return: Converted string
  • access: public
string convert (string $str, string $from, [string $to = null])
  • string $str: Input string
  • string $from: Suspected charset of the input string
  • string $to: Target charset to convert to; defaults to RCMAIL_CHARSET
static detect (line 641)

A method to guess character set of a string.

  • return: Charset name
  • access: public
string detect (string $string, [string $failover = ''])
  • string $string: String.
  • string $failover: Default result for failover.
static error_handler (line 81)

Catch an error and throw an exception.

  • access: public
void error_handler (int $errno, string $errstr)
  • int $errno: Level of the error
  • string $errstr: Error message
static parse (line 96)

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

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

  • return: The validated charset name
  • access: public
string parse (string $input)
  • string $input: Input charset name
static utf7imap_to_utf8 (line 407)

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

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 <[email protected]>

  • return: Output string (UTF-8)
  • access: public
string utf7imap_to_utf8 (string $str)
  • string $str: Input string (UTF7-IMAP)
static utf7_to_utf8 (line 308)

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

  • return: Converted string (UTF-8)
  • access: public
string utf7_to_utf8 (string $str)
  • string $str: Input string (UTF-7)
static utf8_to_utf7imap (line 513)

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

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 <[email protected]>

  • return: Output string (UTF7-IMAP)
  • access: public
string utf8_to_utf7imap (string $str)
  • string $str: Input string (UTF-8)
static utf16_to_utf8 (line 368)

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

  • return: The converted string
  • access: public
string utf16_to_utf8 (string $str)
  • string $str: Input string

Documentation generated on Wed, 23 May 2012 16:40:48 +0200 by phpDocumentor 1.4.4