iso_8859_8.php 3.6 KB

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