From 0a708025e7888422b8dd25582d16234526ef184c Mon Sep 17 00:00:00 2001 From: tokul Date: Wed, 25 Jun 2003 07:06:15 +0000 Subject: [PATCH] Fixed dates in copyright. added koi8-r and koi8-u decoding. fixed ereg in utf-8 decoding. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@5113 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/decode/big5.php | 27 ++++- functions/decode/cp1257.php | 2 +- functions/decode/gb2312.php | 2 +- functions/decode/iso8859-1.php | 2 +- functions/decode/iso8859-10.php | 2 +- functions/decode/iso8859-11.php | 2 +- functions/decode/iso8859-13.php | 2 +- functions/decode/iso8859-14.php | 2 +- functions/decode/iso8859-15.php | 2 +- functions/decode/iso8859-16.php | 2 +- functions/decode/iso8859-2.php | 2 +- functions/decode/iso8859-3.php | 2 +- functions/decode/iso8859-4.php | 2 +- functions/decode/iso8859-5.php | 2 +- functions/decode/iso8859-6.php | 2 +- functions/decode/iso8859-7.php | 2 +- functions/decode/iso8859-8.php | 2 +- functions/decode/iso8859-9.php | 2 +- functions/decode/koi8-r.php | 187 +++++++++++++++++++++++++++++++ functions/decode/koi8-u.php | 190 ++++++++++++++++++++++++++++++++ functions/decode/utf-8.php | 9 +- 21 files changed, 424 insertions(+), 23 deletions(-) create mode 100644 functions/decode/koi8-r.php create mode 100644 functions/decode/koi8-u.php diff --git a/functions/decode/big5.php b/functions/decode/big5.php index 941b1e65..bbc6b1b0 100644 --- a/functions/decode/big5.php +++ b/functions/decode/big5.php @@ -4,11 +4,36 @@ * decode/big5.php * $Id$ * - * Copyright (c) 1999-2003 The SquirrelMail Project Team + * Copyright (c) 2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This file contains big5 decoding function that is needed to read * big5 encoded mails in non-big5 locale. + * + * Original data taken from: + * ftp://ftp.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/OTHER/BIG5.TXT + * + * Name: BIG5 to Unicode table (complete) + * Unicode version: 1.1 + * Table version: 0.0d3 + * Table format: Format A + * Date: 11 February 1994 + * + * Copyright (c) 1991-1994 Unicode, Inc. All Rights reserved. + * + * This file is provided as-is by Unicode, Inc. (The Unicode Consortium). + * No claims are made as to fitness for any particular purpose. No + * warranties of any kind are expressed or implied. The recipient + * agrees to determine applicability of information provided. If this + * file has been provided on magnetic media by Unicode, Inc., the sole + * remedy for any claim will be exchange of defective media within 90 + * days of receipt. + * + * Recipient is granted the right to make copies in any form for + * internal distribution and to freely use the information supplied + * in the creation of products supporting Unicode. Unicode, Inc. + * specifically excludes the right to re-distribute this file directly + * to third parties or other organizations whether for profit or not. * */ diff --git a/functions/decode/cp1257.php b/functions/decode/cp1257.php index e9b9e16d..8a60f6bf 100644 --- a/functions/decode/cp1257.php +++ b/functions/decode/cp1257.php @@ -3,7 +3,7 @@ * decode/cp1257.php * $Id$ * - * Copyright (c) 1999-2003 The SquirrelMail Project Team + * Copyright (c) 2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This file contains cp1257 decoding function that is needed to read diff --git a/functions/decode/gb2312.php b/functions/decode/gb2312.php index d471691a..38be0af3 100644 --- a/functions/decode/gb2312.php +++ b/functions/decode/gb2312.php @@ -10,7 +10,7 @@ * gb2313 encoded mails in non-gb2312 locale. * * Original data taken from: - * ftp://ftp.unicode.org/Public/ + * ftp://ftp.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/GB/GB2312.TXT * * Name: GB2312-80 to Unicode table (complete, hex format) * Unicode version: 3.0 diff --git a/functions/decode/iso8859-1.php b/functions/decode/iso8859-1.php index 87986538..66cff92f 100644 --- a/functions/decode/iso8859-1.php +++ b/functions/decode/iso8859-1.php @@ -3,7 +3,7 @@ * decode/iso8859-1.php * $Id$ * - * Copyright (c) 1999-2003 The SquirrelMail Project Team + * Copyright (c) 2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This file contains iso-8859-1 decoding function that is needed to read diff --git a/functions/decode/iso8859-10.php b/functions/decode/iso8859-10.php index 6a3c3cd1..8cdb0deb 100644 --- a/functions/decode/iso8859-10.php +++ b/functions/decode/iso8859-10.php @@ -3,7 +3,7 @@ * decode/iso8859-10.php * $Id$ * - * Copyright (c) 1999-2003 The SquirrelMail Project Team + * Copyright (c) 2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This file contains iso-8859-10 decoding function that is needed to read diff --git a/functions/decode/iso8859-11.php b/functions/decode/iso8859-11.php index 9f491425..044bc175 100644 --- a/functions/decode/iso8859-11.php +++ b/functions/decode/iso8859-11.php @@ -3,7 +3,7 @@ * decode/iso8859-11.php * $Id$ * - * Copyright (c) 1999-2003 The SquirrelMail Project Team + * Copyright (c) 2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This file contains iso-8859-11 decoding function that is needed to read diff --git a/functions/decode/iso8859-13.php b/functions/decode/iso8859-13.php index 3ceef4c1..8b85a6dd 100644 --- a/functions/decode/iso8859-13.php +++ b/functions/decode/iso8859-13.php @@ -3,7 +3,7 @@ * decode/iso8859-13.php * $Id$ * - * Copyright (c) 1999-2003 The SquirrelMail Project Team + * Copyright (c) 2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This file contains iso-8859-13 decoding function that is needed to read diff --git a/functions/decode/iso8859-14.php b/functions/decode/iso8859-14.php index 8a5bde7d..16ecca9f 100644 --- a/functions/decode/iso8859-14.php +++ b/functions/decode/iso8859-14.php @@ -3,7 +3,7 @@ * decode/iso8859-14.php * $Id$ * - * Copyright (c) 1999-2003 The SquirrelMail Project Team + * Copyright (c) 2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This file contains iso-8859-14 decoding function that is needed to read diff --git a/functions/decode/iso8859-15.php b/functions/decode/iso8859-15.php index 8963b7c3..35a665ea 100644 --- a/functions/decode/iso8859-15.php +++ b/functions/decode/iso8859-15.php @@ -3,7 +3,7 @@ * decode/iso8859-15.php * $Id$ * - * Copyright (c) 1999-2003 The SquirrelMail Project Team + * Copyright (c) 2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This file contains iso-8859-15 decoding function that is needed to read diff --git a/functions/decode/iso8859-16.php b/functions/decode/iso8859-16.php index c4194bb0..90c2396c 100644 --- a/functions/decode/iso8859-16.php +++ b/functions/decode/iso8859-16.php @@ -3,7 +3,7 @@ * decode/iso8859-16.php * $Id$ * - * Copyright (c) 1999-2003 The SquirrelMail Project Team + * Copyright (c) 2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This file contains iso-8859-16 decoding function that is needed to read diff --git a/functions/decode/iso8859-2.php b/functions/decode/iso8859-2.php index 13d25599..c4e03698 100644 --- a/functions/decode/iso8859-2.php +++ b/functions/decode/iso8859-2.php @@ -3,7 +3,7 @@ * decode/iso8859-2.php * $Id$ * - * Copyright (c) 1999-2003 The SquirrelMail Project Team + * Copyright (c) 2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This file contains iso-8859-2 decoding function that is needed to read diff --git a/functions/decode/iso8859-3.php b/functions/decode/iso8859-3.php index c278ea47..8893795f 100644 --- a/functions/decode/iso8859-3.php +++ b/functions/decode/iso8859-3.php @@ -3,7 +3,7 @@ * decode/iso8859-3.php * $Id$ * - * Copyright (c) 1999-2003 The SquirrelMail Project Team + * Copyright (c) 2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This file contains iso-8859-3 decoding function that is needed to read diff --git a/functions/decode/iso8859-4.php b/functions/decode/iso8859-4.php index 0aaa93c5..f93636b3 100644 --- a/functions/decode/iso8859-4.php +++ b/functions/decode/iso8859-4.php @@ -3,7 +3,7 @@ * decode/iso8859-4.php * $Id$ * - * Copyright (c) 1999-2003 The SquirrelMail Project Team + * Copyright (c) 2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This file contains iso-8859-4 decoding function that is needed to read diff --git a/functions/decode/iso8859-5.php b/functions/decode/iso8859-5.php index 1c436361..5d970347 100644 --- a/functions/decode/iso8859-5.php +++ b/functions/decode/iso8859-5.php @@ -3,7 +3,7 @@ * decode/iso8859-5.php * $Id$ * - * Copyright (c) 1999-2003 The SquirrelMail Project Team + * Copyright (c) 2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This file contains iso-8859-5 decoding function that is needed to read diff --git a/functions/decode/iso8859-6.php b/functions/decode/iso8859-6.php index 5336eba5..e90053a3 100644 --- a/functions/decode/iso8859-6.php +++ b/functions/decode/iso8859-6.php @@ -3,7 +3,7 @@ * decode/iso8859-6.php * $Id$ * - * Copyright (c) 1999-2003 The SquirrelMail Project Team + * Copyright (c) 2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This file contains iso-8859-6 decoding function that is needed to read diff --git a/functions/decode/iso8859-7.php b/functions/decode/iso8859-7.php index 27a29c5b..850fef4b 100644 --- a/functions/decode/iso8859-7.php +++ b/functions/decode/iso8859-7.php @@ -3,7 +3,7 @@ * decode/iso8859-7.php * $Id$ * - * Copyright (c) 1999-2003 The SquirrelMail Project Team + * Copyright (c) 2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This file contains iso-8859-7 decoding function that is needed to read diff --git a/functions/decode/iso8859-8.php b/functions/decode/iso8859-8.php index 8a4d5f71..0f3d0b8b 100644 --- a/functions/decode/iso8859-8.php +++ b/functions/decode/iso8859-8.php @@ -3,7 +3,7 @@ * decode/iso8859-8.php * $Id$ * - * Copyright (c) 1999-2003 The SquirrelMail Project Team + * Copyright (c) 2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This file contains iso-8859-8 decoding function that is needed to read diff --git a/functions/decode/iso8859-9.php b/functions/decode/iso8859-9.php index ab6cff96..6d6a52de 100644 --- a/functions/decode/iso8859-9.php +++ b/functions/decode/iso8859-9.php @@ -3,7 +3,7 @@ * decode/iso8859-9.php * $Id$ * - * Copyright (c) 1999-2003 The SquirrelMail Project Team + * Copyright (c) 2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This file contains iso-8859-9 decoding function that is needed to read diff --git a/functions/decode/koi8-r.php b/functions/decode/koi8-r.php new file mode 100644 index 00000000..fee1ab9a --- /dev/null +++ b/functions/decode/koi8-r.php @@ -0,0 +1,187 @@ + + * + * Copyright (c) 1991-1999 Unicode, Inc. All Rights reserved. + * + * This file is provided as-is by Unicode, Inc. (The Unicode Consortium). + * No claims are made as to fitness for any particular purpose. No + * warranties of any kind are expressed or implied. The recipient + * agrees to determine applicability of information provided. If this + * file has been provided on optical media by Unicode, Inc., the sole + * remedy for any claim will be exchange of defective media within 90 + * days of receipt. + * + * Unicode, Inc. hereby grants the right to freely use the information + * supplied in this file in the creation of products supporting the + * Unicode Standard, and to make copies of this file in any form for + * internal or external distribution as long as this notice remains + * attached. + * + */ + +function charset_decode_koi8r ($string) { + global $default_charset; + + if (strtolower($default_charset) == 'koi8-r') + return $string; + + /* Only do the slow convert if there are 8-bit characters */ + /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */ + if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) ) + return $string; + + $koi8r = array( + "\x80" => '─', + "\x81" => '│', + "\x82" => '┌', + "\x83" => '┐', + "\x84" => '└', + "\x85" => '┘', + "\x86" => '├', + "\x87" => '┤', + "\x88" => '┬', + "\x89" => '┴', + "\x8A" => '┼', + "\x8B" => '▀', + "\x8C" => '▄', + "\x8D" => '█', + "\x8E" => '▌', + "\x8F" => '▐', + "\x90" => '░', + "\x91" => '▒', + "\x92" => '▓', + "\x93" => '⌠', + "\x94" => '■', + "\x95" => '∙', + "\x96" => '√', + "\x97" => '≈', + "\x98" => '≤', + "\x99" => '≥', + "\x9A" => ' ', + "\x9B" => '⌡', + "\x9C" => '°', + "\x9D" => '²', + "\x9E" => '·', + "\x9F" => '÷', + "\xA0" => '═', + "\xA1" => '║', + "\xA2" => '╒', + "\xA3" => 'ё', + "\xA4" => '╓', + "\xA5" => '╔', + "\xA6" => '╕', + "\xA7" => '╖', + "\xA8" => '╗', + "\xA9" => '╘', + "\xAA" => '╙', + "\xAB" => '╚', + "\xAC" => '╛', + "\xAD" => '╜', + "\xAE" => '╝', + "\xAF" => '╞', + "\xB0" => '╟', + "\xB1" => '╠', + "\xB2" => '╡', + "\xB3" => 'Ё', + "\xB4" => '╢', + "\xB5" => '╣', + "\xB6" => '╤', + "\xB7" => '╥', + "\xB8" => '╦', + "\xB9" => '╧', + "\xBA" => '╨', + "\xBB" => '╩', + "\xBC" => '╪', + "\xBD" => '╫', + "\xBE" => '╬', + "\xBF" => '©', + "\xC0" => 'ю', + "\xC1" => 'а', + "\xC2" => 'б', + "\xC3" => 'ц', + "\xC4" => 'д', + "\xC5" => 'е', + "\xC6" => 'ф', + "\xC7" => 'г', + "\xC8" => 'х', + "\xC9" => 'и', + "\xCA" => 'й', + "\xCB" => 'к', + "\xCC" => 'л', + "\xCD" => 'м', + "\xCE" => 'н', + "\xCF" => 'о', + "\xD0" => 'п', + "\xD1" => 'я', + "\xD2" => 'р', + "\xD3" => 'с', + "\xD4" => 'т', + "\xD5" => 'у', + "\xD6" => 'ж', + "\xD7" => 'в', + "\xD8" => 'ь', + "\xD9" => 'ы', + "\xDA" => 'з', + "\xDB" => 'ш', + "\xDC" => 'э', + "\xDD" => 'щ', + "\xDE" => 'ч', + "\xDF" => 'ъ', + "\xE0" => 'Ю', + "\xE1" => 'А', + "\xE2" => 'Б', + "\xE3" => 'Ц', + "\xE4" => 'Д', + "\xE5" => 'Е', + "\xE6" => 'Ф', + "\xE7" => 'Г', + "\xE8" => 'Х', + "\xE9" => 'И', + "\xEA" => 'Й', + "\xEB" => 'К', + "\xEC" => 'Л', + "\xED" => 'М', + "\xEE" => 'Н', + "\xEF" => 'О', + "\xF0" => 'П', + "\xF1" => 'Я', + "\xF2" => 'Р', + "\xF3" => 'С', + "\xF4" => 'Т', + "\xF5" => 'У', + "\xF6" => 'Ж', + "\xF7" => 'В', + "\xF8" => 'Ь', + "\xF9" => 'Ы', + "\xFA" => 'З', + "\xFB" => 'Ш', + "\xFC" => 'Э', + "\xFD" => 'Щ', + "\xFE" => 'Ч', + "\xFF" => 'Ъ' + ); + + $string = str_replace(array_keys($koi8r), array_values($koi8r), $string); + + return $string; +} + +?> \ No newline at end of file diff --git a/functions/decode/koi8-u.php b/functions/decode/koi8-u.php new file mode 100644 index 00000000..8b5bb0b9 --- /dev/null +++ b/functions/decode/koi8-u.php @@ -0,0 +1,190 @@ + '─', + "\x81" => '│', + "\x82" => '┌', + "\x83" => '┐', + "\x84" => '└', + "\x85" => '┘', + "\x86" => '├', + "\x87" => '┤', + "\x88" => '┬', + "\x89" => '┴', + "\x8A" => '┼', + "\x8B" => '▀', + "\x8C" => '▄', + "\x8D" => '█', + "\x8E" => '▌', + "\x8F" => '▐', + "\x90" => '░', + "\x91" => '▒', + "\x92" => '▓', + "\x93" => '⌠', + "\x94" => '■', + "\x95" => '∙', + "\x96" => '√', + "\x97" => '≈', + "\x98" => '≤', + "\x99" => '≥', + "\x9A" => ' ', + "\x9B" => '⌡', + "\x9C" => '°', + "\x9D" => '²', + "\x9E" => '·', + "\x9F" => '÷', + "\xA0" => '═', + "\xA1" => '║', + "\xA2" => '╒', + "\xA3" => 'ё', + "\xA4" => 'є', + "\xA5" => '╔', + "\xA6" => 'і', + "\xA7" => 'ї', + "\xA8" => '╗', + "\xA9" => '╘', + "\xAA" => '╙', + "\xAB" => '╚', + "\xAC" => '╛', + "\xAD" => 'ґ', + "\xAE" => '╝', + "\xAF" => '╞', + "\xB0" => '╟', + "\xB1" => '╠', + "\xB2" => '╡', + "\xB3" => 'Ё', + "\xB4" => 'Ѓ', + "\xB5" => '╣', + "\xB6" => 'І', + "\xB7" => 'Ї', + "\xB8" => '╦', + "\xB9" => '╧', + "\xBA" => '╨', + "\xBB" => '╩', + "\xBC" => '╪', + "\xBD" => 'Ґ', + "\xBE" => '╬', + "\xBF" => '©', + "\xC0" => 'ю', + "\xC1" => 'а', + "\xC2" => 'б', + "\xC3" => 'ц', + "\xC4" => 'д', + "\xC5" => 'е', + "\xC6" => 'ф', + "\xC7" => 'г', + "\xC8" => 'х', + "\xC9" => 'и', + "\xCA" => 'й', + "\xCB" => 'к', + "\xCC" => 'л', + "\xCD" => 'м', + "\xCE" => 'н', + "\xCF" => 'о', + "\xD0" => 'п', + "\xD1" => 'я', + "\xD2" => 'р', + "\xD3" => 'с', + "\xD4" => 'т', + "\xD5" => 'у', + "\xD6" => 'ж', + "\xD7" => 'в', + "\xD8" => 'ь', + "\xD9" => 'ы', + "\xDA" => 'з', + "\xDB" => 'ш', + "\xDC" => 'э', + "\xDD" => 'щ', + "\xDE" => 'ч', + "\xDF" => 'ъ', + "\xE0" => 'Ю', + "\xE1" => 'А', + "\xE2" => 'Б', + "\xE3" => 'Ц', + "\xE4" => 'Д', + "\xE5" => 'Е', + "\xE6" => 'Ф', + "\xE7" => 'Г', + "\xE8" => 'Х', + "\xE9" => 'И', + "\xEA" => 'Й', + "\xEB" => 'К', + "\xEC" => 'Л', + "\xED" => 'М', + "\xEE" => 'Н', + "\xEF" => 'О', + "\xF0" => 'П', + "\xF1" => 'Я', + "\xF2" => 'Р', + "\xF3" => 'С', + "\xF4" => 'Т', + "\xF5" => 'У', + "\xF6" => 'Ж', + "\xF7" => 'В', + "\xF8" => 'Ь', + "\xF9" => 'Ы', + "\xFA" => 'З', + "\xFB" => 'Ш', + "\xFC" => 'Э', + "\xFD" => 'Щ', + "\xFE" => 'Ч', + "\xFF" => 'Ъ' + ); + + $string = str_replace(array_keys($koi8u), array_values($koi8u), $string); + + return $string; +} + +?> \ No newline at end of file diff --git a/functions/decode/utf-8.php b/functions/decode/utf-8.php index b3017495..b5baec64 100644 --- a/functions/decode/utf-8.php +++ b/functions/decode/utf-8.php @@ -3,7 +3,7 @@ * decode/utf-8.php * $Id$ * - * Copyright (c) 1999-2003 The SquirrelMail Project Team + * Copyright (c) 2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This file contains utf-8 decoding function that is needed to read @@ -19,15 +19,14 @@ * */ function charset_decode_utf8 ($string) { - global $default_charset, $languages, $sm_notAlias; + global $default_charset; if (strtolower($default_charset) == 'utf-8') return $string; - if (strtolower($languages[$sm_notAlias]['CHARSET']) == 'utf-8') - return $string; /* Only do the slow convert if there are 8-bit characters */ - if (! ereg("[\200-\377]", $string)) + /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */ + if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string)) return $string; // decode three byte unicode characters -- 2.25.1