cp10006.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <?php
  2. /*
  3. * decode/cp10006.php
  4. * $Id$
  5. *
  6. * Copyright (c) 2003 The SquirrelMail Project Team
  7. * Licensed under the GNU GPL. For full terms see the file COPYING.
  8. *
  9. * This file contains cp10006 (MacGreek) decoding function that
  10. * is needed to read cp10006 encoded mails in non-cp10006 locale.
  11. *
  12. * Original data taken from:
  13. * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/MAC/GREEK.TXT
  14. *
  15. * Name: cp10006_MacGreek to Unicode table
  16. * Unicode version: 2.0
  17. * Table version: 2.00
  18. * Table format: Format A
  19. * Date: 04/24/96
  20. * Authors: Lori Brownell <loribr@microsoft.com>
  21. * K.D. Chang <a-kchang@microsoft.com>
  22. */
  23. function charset_decode_cp10006 ($string) {
  24. global $default_charset;
  25. if (strtolower($default_charset) == 'x-mac-greek')
  26. return $string;
  27. /* Only do the slow convert if there are 8-bit characters */
  28. /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */
  29. if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) )
  30. return $string;
  31. $cp10006 = array(
  32. "\0x80" => '&#196;',
  33. "\0x81" => '&#185;',
  34. "\0x82" => '&#178;',
  35. "\0x83" => '&#201;',
  36. "\0x84" => '&#179;',
  37. "\0x85" => '&#214;',
  38. "\0x86" => '&#220;',
  39. "\0x87" => '&#901;',
  40. "\0x88" => '&#224;',
  41. "\0x89" => '&#226;',
  42. "\0x8A" => '&#228;',
  43. "\0x8B" => '&#900;',
  44. "\0x8C" => '&#168;',
  45. "\0x8D" => '&#231;',
  46. "\0x8E" => '&#233;',
  47. "\0x8F" => '&#232;',
  48. "\0x90" => '&#234;',
  49. "\0x91" => '&#235;',
  50. "\0x92" => '&#163;',
  51. "\0x93" => '&#8482;',
  52. "\0x94" => '&#238;',
  53. "\0x95" => '&#239;',
  54. "\0x96" => '&#8226;',
  55. "\0x97" => '&#189;',
  56. "\0x98" => '&#8240;',
  57. "\0x99" => '&#244;',
  58. "\0x9A" => '&#246;',
  59. "\0x9B" => '&#166;',
  60. "\0x9C" => '&#173;',
  61. "\0x9D" => '&#249;',
  62. "\0x9E" => '&#251;',
  63. "\0x9F" => '&#252;',
  64. "\0xA0" => '&#8224;',
  65. "\0xA1" => '&#915;',
  66. "\0xA2" => '&#916;',
  67. "\0xA3" => '&#920;',
  68. "\0xA4" => '&#923;',
  69. "\0xA5" => '&#926;',
  70. "\0xA6" => '&#928;',
  71. "\0xA7" => '&#223;',
  72. "\0xA8" => '&#174;',
  73. "\0xA9" => '&#169;',
  74. "\0xAA" => '&#931;',
  75. "\0xAB" => '&#938;',
  76. "\0xAC" => '&#167;',
  77. "\0xAD" => '&#8800;',
  78. "\0xAE" => '&#176;',
  79. "\0xAF" => '&#903;',
  80. "\0xB0" => '&#913;',
  81. "\0xB1" => '&#177;',
  82. "\0xB2" => '&#8804;',
  83. "\0xB3" => '&#8805;',
  84. "\0xB4" => '&#165;',
  85. "\0xB5" => '&#914;',
  86. "\0xB6" => '&#917;',
  87. "\0xB7" => '&#918;',
  88. "\0xB8" => '&#919;',
  89. "\0xB9" => '&#921;',
  90. "\0xBA" => '&#922;',
  91. "\0xBB" => '&#924;',
  92. "\0xBC" => '&#934;',
  93. "\0xBD" => '&#939;',
  94. "\0xBE" => '&#936;',
  95. "\0xBF" => '&#937;',
  96. "\0xC0" => '&#940;',
  97. "\0xC1" => '&#925;',
  98. "\0xC2" => '&#172;',
  99. "\0xC3" => '&#927;',
  100. "\0xC4" => '&#929;',
  101. "\0xC5" => '&#8776;',
  102. "\0xC6" => '&#932;',
  103. "\0xC7" => '&#171;',
  104. "\0xC8" => '&#187;',
  105. "\0xC9" => '&#8230;',
  106. "\0xCA" => '&#160;',
  107. "\0xCB" => '&#933;',
  108. "\0xCC" => '&#935;',
  109. "\0xCD" => '&#902;',
  110. "\0xCE" => '&#904;',
  111. "\0xCF" => '&#339;',
  112. "\0xD0" => '&#8211;',
  113. "\0xD1" => '&#8213;',
  114. "\0xD2" => '&#8220;',
  115. "\0xD3" => '&#8221;',
  116. "\0xD4" => '&#8216;',
  117. "\0xD5" => '&#8217;',
  118. "\0xD6" => '&#247;',
  119. "\0xD7" => '&#905;',
  120. "\0xD8" => '&#906;',
  121. "\0xD9" => '&#908;',
  122. "\0xDA" => '&#910;',
  123. "\0xDB" => '&#941;',
  124. "\0xDC" => '&#942;',
  125. "\0xDD" => '&#943;',
  126. "\0xDE" => '&#972;',
  127. "\0xDF" => '&#911;',
  128. "\0xE0" => '&#973;',
  129. "\0xE1" => '&#945;',
  130. "\0xE2" => '&#946;',
  131. "\0xE3" => '&#968;',
  132. "\0xE4" => '&#948;',
  133. "\0xE5" => '&#949;',
  134. "\0xE6" => '&#966;',
  135. "\0xE7" => '&#947;',
  136. "\0xE8" => '&#951;',
  137. "\0xE9" => '&#953;',
  138. "\0xEA" => '&#958;',
  139. "\0xEB" => '&#954;',
  140. "\0xEC" => '&#955;',
  141. "\0xED" => '&#956;',
  142. "\0xEE" => '&#957;',
  143. "\0xEF" => '&#959;',
  144. "\0xF0" => '&#960;',
  145. "\0xF1" => '&#974;',
  146. "\0xF2" => '&#961;',
  147. "\0xF3" => '&#963;',
  148. "\0xF4" => '&#964;',
  149. "\0xF5" => '&#952;',
  150. "\0xF6" => '&#969;',
  151. "\0xF7" => '&#962;',
  152. "\0xF8" => '&#967;',
  153. "\0xF9" => '&#965;',
  154. "\0xFA" => '&#950;',
  155. "\0xFB" => '&#970;',
  156. "\0xFC" => '&#971;',
  157. "\0xFD" => '&#912;',
  158. "\0xFE" => '&#944;',
  159. "\0xFF" => '&#65535;'
  160. );
  161. $string = str_replace(array_keys($cp10006), array_values($cp10006), $string);
  162. return $string;
  163. }
  164. ?>