1<?php 2/** 3 * functions/decode/x_mac_devanagari.php 4 * $Id: x_mac_devanagari.php 12467 2007-06-25 15:52:44Z kink $ 5 * 6 * Copyright (c) 2003-2005 The SquirrelMail Project Team 7 * Licensed under the GNU GPL. For full terms see the file COPYING. 8 * 9 * Original data taken from: 10 * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/APPLE/DEVANAGE.TXT 11 * 12 * Contents: 13 * Map (external version) from Mac OS Devanagari 14 * encoding to Unicode 2.1 through Unicode 3.2. 15 * 16 * Copyright: (c) 1995-2002 by Apple Computer, Inc., all rights reserved. 17 * 18 * Contact: charsets@apple.com 19 * 20 * Standard header: 21 * Apple, the Apple logo, and Macintosh are trademarks of Apple 22 * Computer, Inc., registered in the United States and other countries. 23 * Unicode is a trademark of Unicode Inc. For the sake of brevity, 24 * throughout this document, ""Macintosh"" can be used to refer to 25 * Macintosh computers and ""Unicode"" can be used to refer to the 26 * Unicode standard. 27 * 28 * Apple makes no warranty or representation, either express or 29 * implied, with respect to these tables, their quality, accuracy, or 30 * fitness for a particular purpose. In no event will Apple be liable 31 * for direct, indirect, special, incidental, or consequential damages 32 * resulting from any defect or inaccuracy in this document or the 33 * accompanying tables. 34 * 35 * These mapping tables and character lists are subject to change. 36 * The latest tables should be available from the following: 37 * 38 * <http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/> 39 * 40 * @package decode 41 * @subpackage x-mac 42 */ 43 44/** 45 * Decode x-mac-devanagari string 46 * @param string $string String to decode 47 * @return string $string Html formated string 48 */ 49function charset_decode_x_mac_devanagari ($string) { 50 // don't do decoding when there are no 8bit symbols 51 if (! sq_is8bit($string,'x-mac-devanagari')) 52 return $string; 53 54 // Zero joint characters 55 $string=str_replace("\xA1\xE9",'ॐ',$string); 56 $string=str_replace("\xA6\xE9",'ऌ',$string); 57 $string=str_replace("\xA7\xE9",'ॡ',$string); 58 $string=str_replace("\xAA\xE9",'ॠ',$string); 59 $string=str_replace("\xDB\xE9",'ॢ',$string); 60 $string=str_replace("\xDC\xE9",'ॣ',$string); 61 $string=str_replace("\xDF\xE9",'ॄ',$string); 62 $string=str_replace("\xE8\xE8",'्‌',$string); 63 $string=str_replace("\xE8\xE9",'्‍',$string); 64 $string=str_replace("\xEA\xE9",'ऽ',$string); 65 66 // Main replace array 67 $mac_devanagari = array( 68 "\x80" => '×', 69 "\x81" => '−', 70 "\x82" => '–', 71 "\x83" => '—', 72 "\x84" => '‘', 73 "\x85" => '’', 74 "\x86" => '…', 75 "\x87" => '•', 76 "\x88" => '©', 77 "\x89" => '®', 78 "\x8A" => '™', 79 "\x90" => '॥', 80 "\x91" => '॰', 81 "\xA1" => 'ँ', 82 "\xA2" => 'ं', 83 "\xA3" => 'ः', 84 "\xA4" => 'अ', 85 "\xA5" => 'आ', 86 "\xA6" => 'इ', 87 "\xA7" => 'ई', 88 "\xA8" => 'उ', 89 "\xA9" => 'ऊ', 90 "\xAA" => 'ऋ', 91 "\xAB" => 'ऎ', 92 "\xAC" => 'ए', 93 "\xAD" => 'ऐ', 94 "\xAE" => 'ऍ', 95 "\xAF" => 'ऒ', 96 "\xB0" => 'ओ', 97 "\xB1" => 'औ', 98 "\xB2" => 'ऑ', 99 "\xB3" => 'क', 100 "\xB4" => 'ख', 101 "\xB5" => 'ग', 102 "\xB6" => 'घ', 103 "\xB7" => 'ङ', 104 "\xB8" => 'च', 105 "\xB9" => 'छ', 106 "\xBA" => 'ज', 107 "\xBB" => 'झ', 108 "\xBC" => 'ञ', 109 "\xBD" => 'ट', 110 "\xBE" => 'ठ', 111 "\xBF" => 'ड', 112 "\xC0" => 'ढ', 113 "\xC1" => 'ण', 114 "\xC2" => 'त', 115 "\xC3" => 'थ', 116 "\xC4" => 'द', 117 "\xC5" => 'ध', 118 "\xC6" => 'न', 119 "\xC7" => 'ऩ', 120 "\xC8" => 'प', 121 "\xC9" => 'फ', 122 "\xCA" => 'ब', 123 "\xCB" => 'भ', 124 "\xCC" => 'म', 125 "\xCD" => 'य', 126 "\xCE" => 'य़', 127 "\xCF" => 'र', 128 "\xD0" => 'ऱ', 129 "\xD1" => 'ल', 130 "\xD2" => 'ळ', 131 "\xD3" => 'ऴ', 132 "\xD4" => 'व', 133 "\xD5" => 'श', 134 "\xD6" => 'ष', 135 "\xD7" => 'स', 136 "\xD8" => 'ह', 137 "\xD9" => '‎', 138 "\xDA" => 'ा', 139 "\xDB" => 'ि', 140 "\xDC" => 'ी', 141 "\xDD" => 'ु', 142 "\xDE" => 'ू', 143 "\xDF" => 'ृ', 144 "\xE0" => 'ॆ', 145 "\xE1" => 'े', 146 "\xE2" => 'ै', 147 "\xE3" => 'ॅ', 148 "\xE4" => 'ॊ', 149 "\xE5" => 'ो', 150 "\xE6" => 'ौ', 151 "\xE7" => 'ॉ', 152 "\xE8" => '्', 153 "\xE9" => '़', 154 "\xEA" => '।', 155 "\xF1" => '०', 156 "\xF2" => '१', 157 "\xF3" => '२', 158 "\xF4" => '३', 159 "\xF5" => '४', 160 "\xF6" => '५', 161 "\xF7" => '६', 162 "\xF8" => '७', 163 "\xF9" => '८', 164 "\xFA" => '९'); 165 166 $string = str_replace(array_keys($mac_devanagari), array_values($mac_devanagari), $string); 167 168 return $string; 169} 170 171