Source for file iso_8859_5.php

Documentation is available at iso_8859_5.php

  1. <?php
  2.  
  3. /**
  4.  * decode/iso8859-5.php
  5.  *
  6.  * This file contains iso-8859-5 decoding function that is needed to read
  7.  * iso-8859-5 encoded mails in non-iso-8859-5 locale.
  8.  *
  9.  * Original data taken from:
  10.  *  ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-5.TXT
  11.  *
  12.  *   Name:             ISO 8859-5:1999 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_5.php 14845 2020-01-07 08:09:34Z pdontthink $
  39.  * @package squirrelmail
  40.  * @subpackage decode
  41.  */
  42.  
  43. /**
  44.  * Decode iso8859-5 encoded string
  45.  * @param string $string Encoded string
  46.  * @return string $string Decoded string
  47.  */
  48. function charset_decode_iso_8859_5 ($string{
  49.     // don't do decoding when there are no 8bit symbols
  50.     if (sq_is8bit($string,'iso-8859-5'))
  51.         return $string;
  52.  
  53.     $iso8859_5 array(
  54.         "\xA0" => '&#160;',
  55.         "\xA1" => '&#1025;',
  56.         "\xA2" => '&#1026;',
  57.         "\xA3" => '&#1027;',
  58.         "\xA4" => '&#1028;',
  59.         "\xA5" => '&#1029;',
  60.         "\xA6" => '&#1030;',
  61.         "\xA7" => '&#1031;',
  62.         "\xA8" => '&#1032;',
  63.         "\xA9" => '&#1033;',
  64.         "\xAA" => '&#1034;',
  65.         "\xAB" => '&#1035;',
  66.         "\xAC" => '&#1036;',
  67.         "\xAD" => '&#173;',
  68.         "\xAE" => '&#1038;',
  69.         "\xAF" => '&#1039;',
  70.         "\xB0" => '&#1040;',
  71.         "\xB1" => '&#1041;',
  72.         "\xB2" => '&#1042;',
  73.         "\xB3" => '&#1043;',
  74.         "\xB4" => '&#1044;',
  75.         "\xB5" => '&#1045;',
  76.         "\xB6" => '&#1046;',
  77.         "\xB7" => '&#1047;',
  78.         "\xB8" => '&#1048;',
  79.         "\xB9" => '&#1049;',
  80.         "\xBA" => '&#1050;',
  81.         "\xBB" => '&#1051;',
  82.         "\xBC" => '&#1052;',
  83.         "\xBD" => '&#1053;',
  84.         "\xBE" => '&#1054;',
  85.         "\xBF" => '&#1055;',
  86.         "\xC0" => '&#1056;',
  87.         "\xC1" => '&#1057;',
  88.         "\xC2" => '&#1058;',
  89.         "\xC3" => '&#1059;',
  90.         "\xC4" => '&#1060;',
  91.         "\xC5" => '&#1061;',
  92.         "\xC6" => '&#1062;',
  93.         "\xC7" => '&#1063;',
  94.         "\xC8" => '&#1064;',
  95.         "\xC9" => '&#1065;',
  96.         "\xCA" => '&#1066;',
  97.         "\xCB" => '&#1067;',
  98.         "\xCC" => '&#1068;',
  99.         "\xCD" => '&#1069;',
  100.         "\xCE" => '&#1070;',
  101.         "\xCF" => '&#1071;',
  102.         "\xD0" => '&#1072;',
  103.         "\xD1" => '&#1073;',
  104.         "\xD2" => '&#1074;',
  105.         "\xD3" => '&#1075;',
  106.         "\xD4" => '&#1076;',
  107.         "\xD5" => '&#1077;',
  108.         "\xD6" => '&#1078;',
  109.         "\xD7" => '&#1079;',
  110.         "\xD8" => '&#1080;',
  111.         "\xD9" => '&#1081;',
  112.         "\xDA" => '&#1082;',
  113.         "\xDB" => '&#1083;',
  114.         "\xDC" => '&#1084;',
  115.         "\xDD" => '&#1085;',
  116.         "\xDE" => '&#1086;',
  117.         "\xDF" => '&#1087;',
  118.         "\xE0" => '&#1088;',
  119.         "\xE1" => '&#1089;',
  120.         "\xE2" => '&#1090;',
  121.         "\xE3" => '&#1091;',
  122.         "\xE4" => '&#1092;',
  123.         "\xE5" => '&#1093;',
  124.         "\xE6" => '&#1094;',
  125.         "\xE7" => '&#1095;',
  126.         "\xE8" => '&#1096;',
  127.         "\xE9" => '&#1097;',
  128.         "\xEA" => '&#1098;',
  129.         "\xEB" => '&#1099;',
  130.         "\xEC" => '&#1100;',
  131.         "\xED" => '&#1101;',
  132.         "\xEE" => '&#1102;',
  133.         "\xEF" => '&#1103;',
  134.         "\xF0" => '&#8470;',
  135.         "\xF1" => '&#1105;',
  136.         "\xF2" => '&#1106;',
  137.         "\xF3" => '&#1107;',
  138.         "\xF4" => '&#1108;',
  139.         "\xF5" => '&#1109;',
  140.         "\xF6" => '&#1110;',
  141.         "\xF7" => '&#1111;',
  142.         "\xF8" => '&#1112;',
  143.         "\xF9" => '&#1113;',
  144.         "\xFA" => '&#1114;',
  145.         "\xFB" => '&#1115;',
  146.         "\xFC" => '&#1116;',
  147.         "\xFD" => '&#167;',
  148.         "\xFE" => '&#1118;',
  149.         "\xFF" => '&#1119;'
  150.     );
  151.  
  152.     $string str_replace(array_keys($iso8859_5)array_values($iso8859_5)$string);
  153.  
  154.     return $string;
  155. }

Documentation generated on Mon, 13 Jan 2020 04:22:51 +0100 by phpDocumentor 1.4.3