iso_8859_3.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <?php
  2. /**
  3. * decode/iso8859-3.php
  4. *
  5. * This file contains iso-8859-3 decoding function that is needed to read
  6. * iso-8859-3 encoded mails in non-iso-8859-3 locale.
  7. *
  8. * Original data taken from:
  9. * ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-3.TXT
  10. *
  11. * Name: ISO/IEC 8859-3:1999 to Unicode
  12. * Unicode version: 3.0
  13. * Table version: 1.0
  14. * Table format: Format A
  15. * Date: 1999 July 27
  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-3 encoded string
  43. * @param string $string Encoded string
  44. * @return string $string Decoded string
  45. */
  46. function charset_decode_iso_8859_3 ($string) {
  47. // don't do decoding when there are no 8bit symbols
  48. if (! sq_is8bit($string,'iso-8859-3'))
  49. return $string;
  50. $iso8859_3 = array(
  51. "\xA0" => '&#160;',
  52. "\xA1" => '&#294;',
  53. "\xA2" => '&#728;',
  54. "\xA3" => '&#163;',
  55. "\xA4" => '&#164;',
  56. "\xA6" => '&#292;',
  57. "\xA7" => '&#167;',
  58. "\xA8" => '&#168;',
  59. "\xA9" => '&#304;',
  60. "\xAA" => '&#350;',
  61. "\xAB" => '&#286;',
  62. "\xAC" => '&#308;',
  63. "\xAD" => '&#173;',
  64. "\xAF" => '&#379;',
  65. "\xB0" => '&#176;',
  66. "\xB1" => '&#295;',
  67. "\xB2" => '&#178;',
  68. "\xB3" => '&#179;',
  69. "\xB4" => '&#180;',
  70. "\xB5" => '&#181;',
  71. "\xB6" => '&#293;',
  72. "\xB7" => '&#183;',
  73. "\xB8" => '&#184;',
  74. "\xB9" => '&#305;',
  75. "\xBA" => '&#351;',
  76. "\xBB" => '&#287;',
  77. "\xBC" => '&#309;',
  78. "\xBD" => '&#189;',
  79. "\xBF" => '&#380;',
  80. "\xC0" => '&#192;',
  81. "\xC1" => '&#193;',
  82. "\xC2" => '&#194;',
  83. "\xC4" => '&#196;',
  84. "\xC5" => '&#266;',
  85. "\xC6" => '&#264;',
  86. "\xC7" => '&#199;',
  87. "\xC8" => '&#200;',
  88. "\xC9" => '&#201;',
  89. "\xCA" => '&#202;',
  90. "\xCB" => '&#203;',
  91. "\xCC" => '&#204;',
  92. "\xCD" => '&#205;',
  93. "\xCE" => '&#206;',
  94. "\xCF" => '&#207;',
  95. "\xD1" => '&#209;',
  96. "\xD2" => '&#210;',
  97. "\xD3" => '&#211;',
  98. "\xD4" => '&#212;',
  99. "\xD5" => '&#288;',
  100. "\xD6" => '&#214;',
  101. "\xD7" => '&#215;',
  102. "\xD8" => '&#284;',
  103. "\xD9" => '&#217;',
  104. "\xDA" => '&#218;',
  105. "\xDB" => '&#219;',
  106. "\xDC" => '&#220;',
  107. "\xDD" => '&#364;',
  108. "\xDE" => '&#348;',
  109. "\xDF" => '&#223;',
  110. "\xE0" => '&#224;',
  111. "\xE1" => '&#225;',
  112. "\xE2" => '&#226;',
  113. "\xE4" => '&#228;',
  114. "\xE5" => '&#267;',
  115. "\xE6" => '&#265;',
  116. "\xE7" => '&#231;',
  117. "\xE8" => '&#232;',
  118. "\xE9" => '&#233;',
  119. "\xEA" => '&#234;',
  120. "\xEB" => '&#235;',
  121. "\xEC" => '&#236;',
  122. "\xED" => '&#237;',
  123. "\xEE" => '&#238;',
  124. "\xEF" => '&#239;',
  125. "\xF1" => '&#241;',
  126. "\xF2" => '&#242;',
  127. "\xF3" => '&#243;',
  128. "\xF4" => '&#244;',
  129. "\xF5" => '&#289;',
  130. "\xF6" => '&#246;',
  131. "\xF7" => '&#247;',
  132. "\xF8" => '&#285;',
  133. "\xF9" => '&#249;',
  134. "\xFA" => '&#250;',
  135. "\xFB" => '&#251;',
  136. "\xFC" => '&#252;',
  137. "\xFD" => '&#365;',
  138. "\xFE" => '&#349;',
  139. "\xFF" => '&#729;'
  140. );
  141. $string = str_replace(array_keys($iso8859_3), array_values($iso8859_3), $string);
  142. return $string;
  143. }