iso_8859_11.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <?php
  2. /**
  3. * decode/iso8859-11.php
  4. *
  5. * This file contains iso-8859-11 decoding function that is needed to read
  6. * iso-8859-11 encoded mails in non-iso-8859-11 locale.
  7. *
  8. * Original data taken from:
  9. * ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-11.TXT
  10. *
  11. * Name: ISO/IEC 8859-11:2001 to Unicode
  12. * Unicode version: 3.2
  13. * Table version: 1.0
  14. * Table format: Format A
  15. * Date: 2002 October 7
  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-11 string
  43. * @param string $string Encoded string
  44. * @return string $string Decoded string
  45. */
  46. function charset_decode_iso_8859_11 ($string) {
  47. // don't do decoding when there are no 8bit symbols
  48. if (! sq_is8bit($string,'iso-8859-11'))
  49. return $string;
  50. $iso8859_11 = array(
  51. "\xA0" => '&#160;',
  52. "\xA1" => '&#3585;',
  53. "\xA2" => '&#3586;',
  54. "\xA3" => '&#3587;',
  55. "\xA4" => '&#3588;',
  56. "\xA5" => '&#3589;',
  57. "\xA6" => '&#3590;',
  58. "\xA7" => '&#3591;',
  59. "\xA8" => '&#3592;',
  60. "\xA9" => '&#3593;',
  61. "\xAA" => '&#3594;',
  62. "\xAB" => '&#3595;',
  63. "\xAC" => '&#3596;',
  64. "\xAD" => '&#3597;',
  65. "\xAE" => '&#3598;',
  66. "\xAF" => '&#3599;',
  67. "\xB0" => '&#3600;',
  68. "\xB1" => '&#3601;',
  69. "\xB2" => '&#3602;',
  70. "\xB3" => '&#3603;',
  71. "\xB4" => '&#3604;',
  72. "\xB5" => '&#3605;',
  73. "\xB6" => '&#3606;',
  74. "\xB7" => '&#3607;',
  75. "\xB8" => '&#3608;',
  76. "\xB9" => '&#3609;',
  77. "\xBA" => '&#3610;',
  78. "\xBB" => '&#3611;',
  79. "\xBC" => '&#3612;',
  80. "\xBD" => '&#3613;',
  81. "\xBE" => '&#3614;',
  82. "\xBF" => '&#3615;',
  83. "\xC0" => '&#3616;',
  84. "\xC1" => '&#3617;',
  85. "\xC2" => '&#3618;',
  86. "\xC3" => '&#3619;',
  87. "\xC4" => '&#3620;',
  88. "\xC5" => '&#3621;',
  89. "\xC6" => '&#3622;',
  90. "\xC7" => '&#3623;',
  91. "\xC8" => '&#3624;',
  92. "\xC9" => '&#3625;',
  93. "\xCA" => '&#3626;',
  94. "\xCB" => '&#3627;',
  95. "\xCC" => '&#3628;',
  96. "\xCD" => '&#3629;',
  97. "\xCE" => '&#3630;',
  98. "\xCF" => '&#3631;',
  99. "\xD0" => '&#3632;',
  100. "\xD1" => '&#3633;',
  101. "\xD2" => '&#3634;',
  102. "\xD3" => '&#3635;',
  103. "\xD4" => '&#3636;',
  104. "\xD5" => '&#3637;',
  105. "\xD6" => '&#3638;',
  106. "\xD7" => '&#3639;',
  107. "\xD8" => '&#3640;',
  108. "\xD9" => '&#3641;',
  109. "\xDA" => '&#3642;',
  110. "\xDF" => '&#3647;',
  111. "\xE0" => '&#3648;',
  112. "\xE1" => '&#3649;',
  113. "\xE2" => '&#3650;',
  114. "\xE3" => '&#3651;',
  115. "\xE4" => '&#3652;',
  116. "\xE5" => '&#3653;',
  117. "\xE6" => '&#3654;',
  118. "\xE7" => '&#3655;',
  119. "\xE8" => '&#3656;',
  120. "\xE9" => '&#3657;',
  121. "\xEA" => '&#3658;',
  122. "\xEB" => '&#3659;',
  123. "\xEC" => '&#3660;',
  124. "\xED" => '&#3661;',
  125. "\xEE" => '&#3662;',
  126. "\xEF" => '&#3663;',
  127. "\xF0" => '&#3664;',
  128. "\xF1" => '&#3665;',
  129. "\xF2" => '&#3666;',
  130. "\xF3" => '&#3667;',
  131. "\xF4" => '&#3668;',
  132. "\xF5" => '&#3669;',
  133. "\xF6" => '&#3670;',
  134. "\xF7" => '&#3671;',
  135. "\xF8" => '&#3672;',
  136. "\xF9" => '&#3673;',
  137. "\xFA" => '&#3674;',
  138. "\xFB" => '&#3675;'
  139. );
  140. $string = str_replace(array_keys($iso8859_11), array_values($iso8859_11), $string);
  141. return $string;
  142. }