cee5069c651f2dae10f5ac85602df799298342f6
3 * decode/iso-ir-111.php
6 * Copyright (c) 2003 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * This file contains iso-ir-111 decoding function that is needed to read
10 * iso-ir-111 encoded mails in non-iso-ir-111 locale.
12 * Original data taken from:
13 * http://crl.nmsu.edu/~mleisher/csets/ISOIR111.TXT
15 * Original ID: Id: ISOIR111.TXT,v 1.2 1999/08/23 18:34:15 mleisher Exp
16 * Name: ISO IR 111/ECMA Cyrillic to Unicode 2.1 mapping table.
17 * Typed in by hand from
18 * http://www.fingertipsoft.com/ref/cyrillic/charsets.html
19 * Author: Mark Leisher <mleisher@crl.nmsu.edu>
23 * Copyright 1999 Computing Research Labs, New Mexico State University
25 * Permission is hereby granted, free of charge, to any person obtaining a
26 * copy of this software and associated documentation files (the ""Software""),
27 * to deal in the Software without restriction, including without limitation
28 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
29 * and/or sell copies of the Software, and to permit persons to whom the
30 * Software is furnished to do so, subject to the following conditions:
32 * The above copyright notice and this permission notice shall be included in
33 * all copies or substantial portions of the Software.
35 * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
36 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
37 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
38 * THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
39 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
40 * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
41 * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
43 * @package squirrelmail
48 * Decode iso-ir-111 encoded strings
49 * @param string $string Encoded string
50 * @return string Decoded string
52 function charset_decode_iso_ir_111 ($string) {
53 global $default_charset;
55 if (strtolower($default_charset) == 'iso-ir-111')
58 /* Only do the slow convert if there are 8-bit characters */
59 /* there is no 0x80-0x9F letters in ISO-IR-111 */
60 if ( ! ereg("[\241-\377]", $string) )
162 $string = str_replace(array_keys($iso_ir_111), array_values($iso_ir_111), $string);