Source for file iso_8859_7.php

Documentation is available at iso_8859_7.php

  1. <?php
  2.  
  3. /**
  4.  * decode/iso8859-7.php
  5.  *
  6.  * This file contains iso-8859-7 decoding function that is needed to read
  7.  * iso-8859-7 encoded mails in non-iso-8859-7 locale.
  8.  *
  9.  * Original data taken from:
  10.  *  ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-7.TXT
  11.  *
  12.  *   Name:             ISO 8859-7:1987 to Unicode
  13.  *   Unicode version:  3.0
  14.  *   Table version:    1.0
  15.  *   Table format:     Format A
  16.  *   Date:             1999 July 27
  17.  *   Authors:          Ken Whistler <[email protected]>
  18.  *
  19.  * Original copyright:
  20.  *  Copyright (c) 1999 Unicode, Inc.  All Rights reserved.
  21.  *
  22.  *  This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
  23.  *  No claims are made as to fitness for any particular purpose.  No
  24.  *  warranties of any kind are expressed or implied.  The recipient
  25.  *  agrees to determine applicability of information provided.  If this
  26.  *  file has been provided on optical media by Unicode, Inc., the sole
  27.  *  remedy for any claim will be exchange of defective media within 90
  28.  *  days of receipt.
  29.  *
  30.  *  Unicode, Inc. hereby grants the right to freely use the information
  31.  *  supplied in this file in the creation of products supporting the
  32.  *  Unicode Standard, and to make copies of this file in any form for
  33.  *  internal or external distribution as long as this notice remains
  34.  *  attached.
  35.  *
  36.  * @copyright 2003-2020 The SquirrelMail Project Team
  37.  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  38.  * @version $Id: iso_8859_7.php 14840 2020-01-07 07:42:38Z pdontthink $
  39.  * @package squirrelmail
  40.  * @subpackage decode
  41.  */
  42.  
  43. /**
  44.  * Decode iso8859-7 encoded strings
  45.  * @param string $string Encoded string
  46.  * @return string $string Decoded string
  47.  */
  48. function charset_decode_iso_8859_7 ($string{
  49.     // don't do decoding when there are no 8bit symbols
  50.     if (sq_is8bit($string,'iso-8859-7'))
  51.         return $string;
  52.  
  53.     $iso8859_7 array(
  54.         "\xA0" => '&#160;',
  55.         "\xA1" => '&#8216;',
  56.         "\xA2" => '&#8217;',
  57.         "\xA3" => '&#163;',
  58.         "\xA6" => '&#166;',
  59.         "\xA7" => '&#167;',
  60.         "\xA8" => '&#168;',
  61.         "\xA9" => '&#169;',
  62.         "\xAB" => '&#171;',
  63.         "\xAC" => '&#172;',
  64.         "\xAD" => '&#173;',
  65.         "\xAF" => '&#8213;',
  66.         "\xB0" => '&#176;',
  67.         "\xB1" => '&#177;',
  68.         "\xB2" => '&#178;',
  69.         "\xB3" => '&#179;',
  70.         "\xB4" => '&#900;',
  71.         "\xB5" => '&#901;',
  72.         "\xB6" => '&#902;',
  73.         "\xB7" => '&#183;',
  74.         "\xB8" => '&#904;',
  75.         "\xB9" => '&#905;',
  76.         "\xBA" => '&#906;',
  77.         "\xBB" => '&#187;',
  78.         "\xBC" => '&#908;',
  79.         "\xBD" => '&#189;',
  80.         "\xBE" => '&#910;',
  81.         "\xBF" => '&#911;',
  82.         "\xC0" => '&#912;',
  83.         "\xC1" => '&#913;',
  84.         "\xC2" => '&#914;',
  85.         "\xC3" => '&#915;',
  86.         "\xC4" => '&#916;',
  87.         "\xC5" => '&#917;',
  88.         "\xC6" => '&#918;',
  89.         "\xC7" => '&#919;',
  90.         "\xC8" => '&#920;',
  91.         "\xC9" => '&#921;',
  92.         "\xCA" => '&#922;',
  93.         "\xCB" => '&#923;',
  94.         "\xCC" => '&#924;',
  95.         "\xCD" => '&#925;',
  96.         "\xCE" => '&#926;',
  97.         "\xCF" => '&#927;',
  98.         "\xD0" => '&#928;',
  99.         "\xD1" => '&#929;',
  100.         "\xD3" => '&#931;',
  101.         "\xD4" => '&#932;',
  102.         "\xD5" => '&#933;',
  103.         "\xD6" => '&#934;',
  104.         "\xD7" => '&#935;',
  105.         "\xD8" => '&#936;',
  106.         "\xD9" => '&#937;',
  107.         "\xDA" => '&#938;',
  108.         "\xDB" => '&#939;',
  109.         "\xDC" => '&#940;',
  110.         "\xDD" => '&#941;',
  111.         "\xDE" => '&#942;',
  112.         "\xDF" => '&#943;',
  113.         "\xE0" => '&#944;',
  114.         "\xE1" => '&#945;',
  115.         "\xE2" => '&#946;',
  116.         "\xE3" => '&#947;',
  117.         "\xE4" => '&#948;',
  118.         "\xE5" => '&#949;',
  119.         "\xE6" => '&#950;',
  120.         "\xE7" => '&#951;',
  121.         "\xE8" => '&#952;',
  122.         "\xE9" => '&#953;',
  123.         "\xEA" => '&#954;',
  124.         "\xEB" => '&#955;',
  125.         "\xEC" => '&#956;',
  126.         "\xED" => '&#957;',
  127.         "\xEE" => '&#958;',
  128.         "\xEF" => '&#959;',
  129.         "\xF0" => '&#960;',
  130.         "\xF1" => '&#961;',
  131.         "\xF2" => '&#962;',
  132.         "\xF3" => '&#963;',
  133.         "\xF4" => '&#964;',
  134.         "\xF5" => '&#965;',
  135.         "\xF6" => '&#966;',
  136.         "\xF7" => '&#967;',
  137.         "\xF8" => '&#968;',
  138.         "\xF9" => '&#969;',
  139.         "\xFA" => '&#970;',
  140.         "\xFB" => '&#971;',
  141.         "\xFC" => '&#972;',
  142.         "\xFD" => '&#973;',
  143.         "\xFE" => '&#974;'
  144.     );
  145.  
  146.     $string str_replace(array_keys($iso8859_7)array_values($iso8859_7)$string);
  147.  
  148.     return $string;
  149. }

Documentation generated on Mon, 13 Jan 2020 04:24:50 +0100 by phpDocumentor 1.4.3