iso8859-11.php 3.8 KB

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