Fixed dates in copyright. added koi8-r and koi8-u decoding. fixed ereg in
authortokul <tokul@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 25 Jun 2003 07:06:15 +0000 (07:06 +0000)
committertokul <tokul@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 25 Jun 2003 07:06:15 +0000 (07:06 +0000)
utf-8 decoding.

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@5113 7612ce4b-ef26-0410-bec9-ea0150e637f0

21 files changed:
functions/decode/big5.php
functions/decode/cp1257.php
functions/decode/gb2312.php
functions/decode/iso8859-1.php
functions/decode/iso8859-10.php
functions/decode/iso8859-11.php
functions/decode/iso8859-13.php
functions/decode/iso8859-14.php
functions/decode/iso8859-15.php
functions/decode/iso8859-16.php
functions/decode/iso8859-2.php
functions/decode/iso8859-3.php
functions/decode/iso8859-4.php
functions/decode/iso8859-5.php
functions/decode/iso8859-6.php
functions/decode/iso8859-7.php
functions/decode/iso8859-8.php
functions/decode/iso8859-9.php
functions/decode/koi8-r.php [new file with mode: 0644]
functions/decode/koi8-u.php [new file with mode: 0644]
functions/decode/utf-8.php

index 941b1e6526f816cc373e0cb8be1af90b6a55d909..bbc6b1b0888642dd5f657301e5499759e77c491d 100644 (file)
@@ -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.
  *
  */
 
index e9b9e16dca867ef3e6c929b444939530e1362f30..8a60f6bfc6d0ed6f2b086b51478ca87ec04b0dde 100644 (file)
@@ -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
index d471691a855741e0302149d66e4d824aea43edcc..38be0af38a94ee3794b62277773935100693a0d0 100644 (file)
@@ -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
index 87986538d2b32b616caa149dc6ba4fa1f64ed162..66cff92ff73e919dedc9ea63abaac8c326c57787 100644 (file)
@@ -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
index 6a3c3cd14caf4f0f1bc39df5cfb4fbbab4e55ba5..8cdb0deb533c0cf331ffb1e04a42a721cd76fddb 100644 (file)
@@ -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
index 9f491425dfa1d346362e7153880bd94d8f4a5a5c..044bc1756f81ee1ec92bb336490f6a4a28788752 100644 (file)
@@ -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
index 3ceef4c18bf47bd9a88f3dc06adb6d7043d45b17..8b85a6dd689ff73d24cda4fc3ced0b7338aae169 100644 (file)
@@ -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
index 8a5bde7dd27e536a5b6f713634a871b1d655d597..16ecca9f6922d9ce8c996d714ab3116236840ed6 100644 (file)
@@ -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
index 8963b7c325e12c27dede84638ce1cbd84f48ac09..35a665ea15e346872527a6b38d6519370653089b 100644 (file)
@@ -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
index c4194bb0950737d2ac5faa3bd91e713e0cba1822..90c2396ce6c2c0a62ca3ebfb446c563980c561ae 100644 (file)
@@ -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
index 13d255998e052dda524fad232eb73ac9d1fa30f5..c4e03698b1686b4e3b5485cfea7443219ad383ed 100644 (file)
@@ -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
index c278ea471517b4e750d7d917d0e814fb59c2f4a4..8893795fe7e48784e0c21a5148367db166482105 100644 (file)
@@ -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
index 0aaa93c573a78e3e7348693f57be3c3dd57f0c81..f93636b3bf7808184db687b5dbd3eae01c5ed1f0 100644 (file)
@@ -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
index 1c4363611d54ac5aa5573094d09598d31d83cb4e..5d9703476975570342ac289521893e0e15bb1f5b 100644 (file)
@@ -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
index 5336eba55d29ddb1907fe762f3fc86c5ffeef262..e90053a334005f2e9c0217f07effe3a649895e0f 100644 (file)
@@ -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
index 27a29c5b8d0c12fb932aa31775099143a8aa9472..850fef4b708bdd48f61e60becd204b6098735654 100644 (file)
@@ -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
index 8a4d5f71c18f0f0b9bd3e724f0af4f110a95454b..0f3d0b8b8ae821f3c1114358e3b359a5d984bc55 100644 (file)
@@ -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
index ab6cff9677f6692463b14f9e1e491e74ab41832e..6d6a52dead2fb1d074e1c973a904a676d191c5e9 100644 (file)
@@ -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 (file)
index 0000000..fee1ab9
--- /dev/null
@@ -0,0 +1,187 @@
+<?php
+/*
+ * decode/koi8-r.php
+ * $Id$
+ *
+ * Copyright (c) 2003 The SquirrelMail Project Team
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
+ *
+ * This file contains koi8-r decoding function that is needed to read
+ * koi8-r encoded mails in non-koi8-r locale.
+ * 
+ * Original data taken from:
+ *  ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MISC/KOI8-R.TXT
+ *
+ * Name:             KOI8-R (RFC1489) to Unicode
+ * Unicode version:  3.0
+ * Table version:    1.0
+ * Table format:     Format A
+ * Date:             18 August 1999
+ * Authors:          Helmut Richter <richter@lrz.de>
+ *
+ * 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" => '&#9472;',
+       "\x81" => '&#9474;',
+       "\x82" => '&#9484;',
+       "\x83" => '&#9488;',
+       "\x84" => '&#9492;',
+       "\x85" => '&#9496;',
+       "\x86" => '&#9500;',
+       "\x87" => '&#9508;',
+       "\x88" => '&#9516;',
+       "\x89" => '&#9524;',
+       "\x8A" => '&#9532;',
+       "\x8B" => '&#9600;',
+       "\x8C" => '&#9604;',
+       "\x8D" => '&#9608;',
+       "\x8E" => '&#9612;',
+       "\x8F" => '&#9616;',
+       "\x90" => '&#9617;',
+       "\x91" => '&#9618;',
+       "\x92" => '&#9619;',
+       "\x93" => '&#8992;',
+       "\x94" => '&#9632;',
+       "\x95" => '&#8729;',
+       "\x96" => '&#8730;',
+       "\x97" => '&#8776;',
+       "\x98" => '&#8804;',
+       "\x99" => '&#8805;',
+       "\x9A" => '&#160;',
+       "\x9B" => '&#8993;',
+       "\x9C" => '&#176;',
+       "\x9D" => '&#178;',
+       "\x9E" => '&#183;',
+       "\x9F" => '&#247;',
+       "\xA0" => '&#9552;',
+       "\xA1" => '&#9553;',
+       "\xA2" => '&#9554;',
+       "\xA3" => '&#1105;',
+       "\xA4" => '&#9555;',
+       "\xA5" => '&#9556;',
+       "\xA6" => '&#9557;',
+       "\xA7" => '&#9558;',
+       "\xA8" => '&#9559;',
+       "\xA9" => '&#9560;',
+       "\xAA" => '&#9561;',
+       "\xAB" => '&#9562;',
+       "\xAC" => '&#9563;',
+       "\xAD" => '&#9564;',
+       "\xAE" => '&#9565;',
+       "\xAF" => '&#9566;',
+       "\xB0" => '&#9567;',
+       "\xB1" => '&#9568;',
+       "\xB2" => '&#9569;',
+       "\xB3" => '&#1025;',
+       "\xB4" => '&#9570;',
+       "\xB5" => '&#9571;',
+       "\xB6" => '&#9572;',
+       "\xB7" => '&#9573;',
+       "\xB8" => '&#9574;',
+       "\xB9" => '&#9575;',
+       "\xBA" => '&#9576;',
+       "\xBB" => '&#9577;',
+       "\xBC" => '&#9578;',
+       "\xBD" => '&#9579;',
+       "\xBE" => '&#9580;',
+       "\xBF" => '&#169;',
+       "\xC0" => '&#1102;',
+       "\xC1" => '&#1072;',
+       "\xC2" => '&#1073;',
+       "\xC3" => '&#1094;',
+       "\xC4" => '&#1076;',
+       "\xC5" => '&#1077;',
+       "\xC6" => '&#1092;',
+       "\xC7" => '&#1075;',
+       "\xC8" => '&#1093;',
+       "\xC9" => '&#1080;',
+       "\xCA" => '&#1081;',
+       "\xCB" => '&#1082;',
+       "\xCC" => '&#1083;',
+       "\xCD" => '&#1084;',
+       "\xCE" => '&#1085;',
+       "\xCF" => '&#1086;',
+       "\xD0" => '&#1087;',
+       "\xD1" => '&#1103;',
+       "\xD2" => '&#1088;',
+       "\xD3" => '&#1089;',
+       "\xD4" => '&#1090;',
+       "\xD5" => '&#1091;',
+       "\xD6" => '&#1078;',
+       "\xD7" => '&#1074;',
+       "\xD8" => '&#1100;',
+       "\xD9" => '&#1099;',
+       "\xDA" => '&#1079;',
+       "\xDB" => '&#1096;',
+       "\xDC" => '&#1101;',
+       "\xDD" => '&#1097;',
+       "\xDE" => '&#1095;',
+       "\xDF" => '&#1098;',
+       "\xE0" => '&#1070;',
+       "\xE1" => '&#1040;',
+       "\xE2" => '&#1041;',
+       "\xE3" => '&#1062;',
+       "\xE4" => '&#1044;',
+       "\xE5" => '&#1045;',
+       "\xE6" => '&#1060;',
+       "\xE7" => '&#1043;',
+       "\xE8" => '&#1061;',
+       "\xE9" => '&#1048;',
+       "\xEA" => '&#1049;',
+       "\xEB" => '&#1050;',
+       "\xEC" => '&#1051;',
+       "\xED" => '&#1052;',
+       "\xEE" => '&#1053;',
+       "\xEF" => '&#1054;',
+       "\xF0" => '&#1055;',
+       "\xF1" => '&#1071;',
+       "\xF2" => '&#1056;',
+       "\xF3" => '&#1057;',
+       "\xF4" => '&#1058;',
+       "\xF5" => '&#1059;',
+       "\xF6" => '&#1046;',
+       "\xF7" => '&#1042;',
+       "\xF8" => '&#1068;',
+       "\xF9" => '&#1067;',
+       "\xFA" => '&#1047;',
+       "\xFB" => '&#1064;',
+       "\xFC" => '&#1069;',
+       "\xFD" => '&#1065;',
+       "\xFE" => '&#1063;',
+       "\xFF" => '&#1066;'
+    );
+
+    $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 (file)
index 0000000..8b5bb0b
--- /dev/null
@@ -0,0 +1,190 @@
+<?php
+/*
+ * decode/koi8-u.php
+ * $Id$
+ *
+ * Copyright (c) 2003 The SquirrelMail Project Team
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
+ *
+ * This file contains koi8-u decoding function that is needed to read
+ * koi8-u encoded mails in non-koi8-u locale.
+ * 
+ * Original data taken from rfc2319
+ *
+ * Original copyright:
+ *
+ * Copyright (C) The Internet Society (1998).  All Rights Reserved.
+ *
+ * This document and translations of it may be copied and furnished to
+ * others, and derivative works that comment on or otherwise explain it
+ * or assist in its implementation may be prepared, copied, published
+ * and distributed, in whole or in part, without restriction of any
+ * kind, provided that the above copyright notice and this paragraph are
+ * included on all such copies and derivative works.  However, this
+ * document itself may not be modified in any way, such as by removing
+ * the copyright notice or references to the Internet Society or other
+ * Internet organizations, except as needed for the purpose of
+ * developing Internet standards in which case the procedures for
+ * copyrights defined in the Internet Standards process must be
+ * followed, or as required to translate it into languages other than
+ * English.
+ *
+ * The limited permissions granted above are perpetual and will not be
+ * revoked by the Internet Society or its successors or assigns.
+ *
+ * This document and the information contained herein is provided on an
+ * "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
+ * TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
+ * BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
+ * HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+function charset_decode_koi8u ($string) {
+    global $default_charset;
+
+    if (strtolower($default_charset) == 'koi8-u')
+        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;
+
+    $koi8u = array(
+       "\x80" => '&#9472;',
+       "\x81" => '&#9474;',
+       "\x82" => '&#9484;',
+       "\x83" => '&#9488;',
+       "\x84" => '&#9492;',
+       "\x85" => '&#9496;',
+       "\x86" => '&#9500;',
+       "\x87" => '&#9508;',
+       "\x88" => '&#9516;',
+       "\x89" => '&#9524;',
+       "\x8A" => '&#9532;',
+       "\x8B" => '&#9600;',
+       "\x8C" => '&#9604;',
+       "\x8D" => '&#9608;',
+       "\x8E" => '&#9612;',
+       "\x8F" => '&#9616;',
+       "\x90" => '&#9617;',
+       "\x91" => '&#9618;',
+       "\x92" => '&#9619;',
+       "\x93" => '&#8992;',
+       "\x94" => '&#9632;',
+       "\x95" => '&#8729;',
+       "\x96" => '&#8730;',
+       "\x97" => '&#8776;',
+       "\x98" => '&#8804;',
+       "\x99" => '&#8805;',
+       "\x9A" => '&#160;',
+       "\x9B" => '&#8993;',
+       "\x9C" => '&#176;',
+       "\x9D" => '&#178;',
+       "\x9E" => '&#183;',
+       "\x9F" => '&#247;',
+       "\xA0" => '&#9552;',
+       "\xA1" => '&#9553;',
+       "\xA2" => '&#9554;',
+       "\xA3" => '&#1105;',
+       "\xA4" => '&#1108;',
+       "\xA5" => '&#9556;',
+       "\xA6" => '&#1110;',
+       "\xA7" => '&#1111;',
+       "\xA8" => '&#9559;',
+       "\xA9" => '&#9560;',
+       "\xAA" => '&#9561;',
+       "\xAB" => '&#9562;',
+       "\xAC" => '&#9563;',
+       "\xAD" => '&#1169;',
+       "\xAE" => '&#9565;',
+       "\xAF" => '&#9566;',
+       "\xB0" => '&#9567;',
+       "\xB1" => '&#9568;',
+       "\xB2" => '&#9569;',
+       "\xB3" => '&#1025;',
+       "\xB4" => '&#1027;',
+       "\xB5" => '&#9571;',
+       "\xB6" => '&#1030;',
+       "\xB7" => '&#1031;',
+       "\xB8" => '&#9574;',
+       "\xB9" => '&#9575;',
+       "\xBA" => '&#9576;',
+       "\xBB" => '&#9577;',
+       "\xBC" => '&#9578;',
+       "\xBD" => '&#1168;',
+       "\xBE" => '&#9580;',
+       "\xBF" => '&#169;',
+       "\xC0" => '&#1102;',
+       "\xC1" => '&#1072;',
+       "\xC2" => '&#1073;',
+       "\xC3" => '&#1094;',
+       "\xC4" => '&#1076;',
+       "\xC5" => '&#1077;',
+       "\xC6" => '&#1092;',
+       "\xC7" => '&#1075;',
+       "\xC8" => '&#1093;',
+       "\xC9" => '&#1080;',
+       "\xCA" => '&#1081;',
+       "\xCB" => '&#1082;',
+       "\xCC" => '&#1083;',
+       "\xCD" => '&#1084;',
+       "\xCE" => '&#1085;',
+       "\xCF" => '&#1086;',
+       "\xD0" => '&#1087;',
+       "\xD1" => '&#1103;',
+       "\xD2" => '&#1088;',
+       "\xD3" => '&#1089;',
+       "\xD4" => '&#1090;',
+       "\xD5" => '&#1091;',
+       "\xD6" => '&#1078;',
+       "\xD7" => '&#1074;',
+       "\xD8" => '&#1100;',
+       "\xD9" => '&#1099;',
+       "\xDA" => '&#1079;',
+       "\xDB" => '&#1096;',
+       "\xDC" => '&#1101;',
+       "\xDD" => '&#1097;',
+       "\xDE" => '&#1095;',
+       "\xDF" => '&#1098;',
+       "\xE0" => '&#1070;',
+       "\xE1" => '&#1040;',
+       "\xE2" => '&#1041;',
+       "\xE3" => '&#1062;',
+       "\xE4" => '&#1044;',
+       "\xE5" => '&#1045;',
+       "\xE6" => '&#1060;',
+       "\xE7" => '&#1043;',
+       "\xE8" => '&#1061;',
+       "\xE9" => '&#1048;',
+       "\xEA" => '&#1049;',
+       "\xEB" => '&#1050;',
+       "\xEC" => '&#1051;',
+       "\xED" => '&#1052;',
+       "\xEE" => '&#1053;',
+       "\xEF" => '&#1054;',
+       "\xF0" => '&#1055;',
+       "\xF1" => '&#1071;',
+       "\xF2" => '&#1056;',
+       "\xF3" => '&#1057;',
+       "\xF4" => '&#1058;',
+       "\xF5" => '&#1059;',
+       "\xF6" => '&#1046;',
+       "\xF7" => '&#1042;',
+       "\xF8" => '&#1068;',
+       "\xF9" => '&#1067;',
+       "\xFA" => '&#1047;',
+       "\xFB" => '&#1064;',
+       "\xFC" => '&#1069;',
+       "\xFD" => '&#1065;',
+       "\xFE" => '&#1063;',
+       "\xFF" => '&#1066;'
+    );
+
+    $string = str_replace(array_keys($koi8u), array_values($koi8u), $string);
+
+    return $string;
+}
+
+?>
\ No newline at end of file
index b30174956c1e57d1ccce1f96da8e7d0dabe6b5e6..b5baec647d32f2796a54fe836044136849a7e03d 100644 (file)
@@ -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
  * 
  */
 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