iso8859-8.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?php
  2. /*
  3. * decode/iso8859-8.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 iso-8859-8 decoding function that is needed to read
  10. * iso-8859-8 encoded mails in non-iso-8859-8 locale.
  11. *
  12. * Original data taken from:
  13. * ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-8.TXT
  14. *
  15. * Name: ISO/IEC 8859-8:1999 to Unicode
  16. * Unicode version: 3.0
  17. * Table version: 1.1
  18. * Table format: Format A
  19. * Date: 2000-Jan-03
  20. * Authors: Ken Whistler <kenw@sybase.com>
  21. *
  22. * Original copyright:
  23. * Copyright (c) 1999 Unicode, Inc. All Rights reserved.
  24. *
  25. * This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
  26. * No claims are made as to fitness for any particular purpose. No
  27. * warranties of any kind are expressed or implied. The recipient
  28. * agrees to determine applicability of information provided. If this
  29. * file has been provided on optical media by Unicode, Inc., the sole
  30. * remedy for any claim will be exchange of defective media within 90
  31. * days of receipt.
  32. *
  33. * Unicode, Inc. hereby grants the right to freely use the information
  34. * supplied in this file in the creation of products supporting the
  35. * Unicode Standard, and to make copies of this file in any form for
  36. * internal or external distribution as long as this notice remains
  37. * attached.
  38. *
  39. */
  40. function charset_decode_iso8859_8 ($string) {
  41. global $default_charset;
  42. if (strtolower($default_charset) == 'iso8859-8')
  43. return $string;
  44. /* Only do the slow convert if there are 8-bit characters */
  45. /* there is no 0x80-0x9F letters in ISO8859-* */
  46. if ( ! ereg("[\241-\377]", $string) )
  47. return $string;
  48. $iso8859_8 = array(
  49. "\xA0" => '&#160;',
  50. "\xA2" => '&#162;',
  51. "\xA3" => '&#163;',
  52. "\xA4" => '&#164;',
  53. "\xA5" => '&#165;',
  54. "\xA6" => '&#166;',
  55. "\xA7" => '&#167;',
  56. "\xA8" => '&#168;',
  57. "\xA9" => '&#169;',
  58. "\xAA" => '&#215;',
  59. "\xAB" => '&#171;',
  60. "\xAC" => '&#172;',
  61. "\xAD" => '&#173;',
  62. "\xAE" => '&#174;',
  63. "\xAF" => '&#175;',
  64. "\xB0" => '&#176;',
  65. "\xB1" => '&#177;',
  66. "\xB2" => '&#178;',
  67. "\xB3" => '&#179;',
  68. "\xB4" => '&#180;',
  69. "\xB5" => '&#181;',
  70. "\xB6" => '&#182;',
  71. "\xB7" => '&#183;',
  72. "\xB8" => '&#184;',
  73. "\xB9" => '&#185;',
  74. "\xBA" => '&#247;',
  75. "\xBB" => '&#187;',
  76. "\xBC" => '&#188;',
  77. "\xBD" => '&#189;',
  78. "\xBE" => '&#190;',
  79. "\xDF" => '&#8215;',
  80. "\xE0" => '&#1488;',
  81. "\xE1" => '&#1489;',
  82. "\xE2" => '&#1490;',
  83. "\xE3" => '&#1491;',
  84. "\xE4" => '&#1492;',
  85. "\xE5" => '&#1493;',
  86. "\xE6" => '&#1494;',
  87. "\xE7" => '&#1495;',
  88. "\xE8" => '&#1496;',
  89. "\xE9" => '&#1497;',
  90. "\xEA" => '&#1498;',
  91. "\xEB" => '&#1499;',
  92. "\xEC" => '&#1500;',
  93. "\xED" => '&#1501;',
  94. "\xEE" => '&#1502;',
  95. "\xEF" => '&#1503;',
  96. "\xF0" => '&#1504;',
  97. "\xF1" => '&#1505;',
  98. "\xF2" => '&#1506;',
  99. "\xF3" => '&#1507;',
  100. "\xF4" => '&#1508;',
  101. "\xF5" => '&#1509;',
  102. "\xF6" => '&#1510;',
  103. "\xF7" => '&#1511;',
  104. "\xF8" => '&#1512;',
  105. "\xF9" => '&#1513;',
  106. "\xFA" => '&#1514;',
  107. "\xFD" => '&#8206;',
  108. "\xFE" => '&#8207;'
  109. );
  110. $string = str_replace(array_keys($iso8859_8), array_values($iso8859_8), $string);
  111. return $string;
  112. }
  113. ?>