Source for file cp1253.php

Documentation is available at cp1253.php

  1. <?php
  2.  
  3. /**
  4.  * decode/cp1253.php
  5.  *
  6.  * This file contains cp1253 decoding function that is needed to read
  7.  * cp1253 encoded mails in non-cp1253 locale.
  8.  *
  9.  * Original data taken from:
  10.  *  ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1253.TXT
  11.  *
  12.  *   Name:     cp1253 to Unicode table
  13.  *   Unicode version: 2.0
  14.  *   Table version: 2.01
  15.  *   Table format:  Format A
  16.  *   Date:          04/15/98
  17.  *   Contact:       [email protected]
  18.  *
  19.  * @copyright 2003-2020 The SquirrelMail Project Team
  20.  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  21.  * @version $Id: cp1253.php 14845 2020-01-07 08:09:34Z pdontthink $
  22.  * @package squirrelmail
  23.  * @subpackage decode
  24.  */
  25.  
  26. /**
  27.  * Decode cp1253-encoded string
  28.  * @param string $string Encoded string
  29.  * @return string $string Decoded string
  30.  */
  31. function charset_decode_cp1253 ($string{
  32.     // don't do decoding when there are no 8bit symbols
  33.     if (sq_is8bit($string,'windows-1253'))
  34.         return $string;
  35.  
  36.     $cp1253 array(
  37.         "\x80" => '&#8364;',
  38.         "\x81" => '&#65533;',
  39.         "\x82" => '&#8218;',
  40.         "\x83" => '&#402;',
  41.         "\x84" => '&#8222;',
  42.         "\x85" => '&#8230;',
  43.         "\x86" => '&#8224;',
  44.         "\x87" => '&#8225;',
  45.         "\x88" => '&#65533;',
  46.         "\x89" => '&#8240;',
  47.         "\x8A" => '&#65533;',
  48.         "\x8B" => '&#8249;',
  49.         "\x8C" => '&#65533;',
  50.         "\x8D" => '&#65533;',
  51.         "\x8E" => '&#65533;',
  52.         "\x8F" => '&#65533;',
  53.         "\x90" => '&#65533;',
  54.         "\x91" => '&#8216;',
  55.         "\x92" => '&#8217;',
  56.         "\x93" => '&#8220;',
  57.         "\x94" => '&#8221;',
  58.         "\x95" => '&#8226;',
  59.         "\x96" => '&#8211;',
  60.         "\x97" => '&#8212;',
  61.         "\x98" => '&#65533;',
  62.         "\x99" => '&#8482;',
  63.         "\x9A" => '&#65533;',
  64.         "\x9B" => '&#8250;',
  65.         "\x9C" => '&#65533;',
  66.         "\x9D" => '&#65533;',
  67.         "\x9E" => '&#65533;',
  68.         "\x9F" => '&#65533;',
  69.         "\xA0" => '&#160;',
  70.         "\xA1" => '&#901;',
  71.         "\xA2" => '&#902;',
  72.         "\xA3" => '&#163;',
  73.         "\xA4" => '&#164;',
  74.         "\xA5" => '&#165;',
  75.         "\xA6" => '&#166;',
  76.         "\xA7" => '&#167;',
  77.         "\xA8" => '&#168;',
  78.         "\xA9" => '&#169;',
  79.         "\xAA" => '&#65533;',
  80.         "\xAB" => '&#171;',
  81.         "\xAC" => '&#172;',
  82.         "\xAD" => '&#173;',
  83.         "\xAE" => '&#174;',
  84.         "\xAF" => '&#8213;',
  85.         "\xB0" => '&#176;',
  86.         "\xB1" => '&#177;',
  87.         "\xB2" => '&#178;',
  88.         "\xB3" => '&#179;',
  89.         "\xB4" => '&#900;',
  90.         "\xB5" => '&#181;',
  91.         "\xB6" => '&#182;',
  92.         "\xB7" => '&#183;',
  93.         "\xB8" => '&#904;',
  94.         "\xB9" => '&#905;',
  95.         "\xBA" => '&#906;',
  96.         "\xBB" => '&#187;',
  97.         "\xBC" => '&#908;',
  98.         "\xBD" => '&#189;',
  99.         "\xBE" => '&#910;',
  100.         "\xBF" => '&#911;',
  101.         "\xC0" => '&#912;',
  102.         "\xC1" => '&#913;',
  103.         "\xC2" => '&#914;',
  104.         "\xC3" => '&#915;',
  105.         "\xC4" => '&#916;',
  106.         "\xC5" => '&#917;',
  107.         "\xC6" => '&#918;',
  108.         "\xC7" => '&#919;',
  109.         "\xC8" => '&#920;',
  110.         "\xC9" => '&#921;',
  111.         "\xCA" => '&#922;',
  112.         "\xCB" => '&#923;',
  113.         "\xCC" => '&#924;',
  114.         "\xCD" => '&#925;',
  115.         "\xCE" => '&#926;',
  116.         "\xCF" => '&#927;',
  117.         "\xD0" => '&#928;',
  118.         "\xD1" => '&#929;',
  119.         "\xD2" => '&#65533;',
  120.         "\xD3" => '&#931;',
  121.         "\xD4" => '&#932;',
  122.         "\xD5" => '&#933;',
  123.         "\xD6" => '&#934;',
  124.         "\xD7" => '&#935;',
  125.         "\xD8" => '&#936;',
  126.         "\xD9" => '&#937;',
  127.         "\xDA" => '&#938;',
  128.         "\xDB" => '&#939;',
  129.         "\xDC" => '&#940;',
  130.         "\xDD" => '&#941;',
  131.         "\xDE" => '&#942;',
  132.         "\xDF" => '&#943;',
  133.         "\xE0" => '&#944;',
  134.         "\xE1" => '&#945;',
  135.         "\xE2" => '&#946;',
  136.         "\xE3" => '&#947;',
  137.         "\xE4" => '&#948;',
  138.         "\xE5" => '&#949;',
  139.         "\xE6" => '&#950;',
  140.         "\xE7" => '&#951;',
  141.         "\xE8" => '&#952;',
  142.         "\xE9" => '&#953;',
  143.         "\xEA" => '&#954;',
  144.         "\xEB" => '&#955;',
  145.         "\xEC" => '&#956;',
  146.         "\xED" => '&#957;',
  147.         "\xEE" => '&#958;',
  148.         "\xEF" => '&#959;',
  149.         "\xF0" => '&#960;',
  150.         "\xF1" => '&#961;',
  151.         "\xF2" => '&#962;',
  152.         "\xF3" => '&#963;',
  153.         "\xF4" => '&#964;',
  154.         "\xF5" => '&#965;',
  155.         "\xF6" => '&#966;',
  156.         "\xF7" => '&#967;',
  157.         "\xF8" => '&#968;',
  158.         "\xF9" => '&#969;',
  159.         "\xFA" => '&#970;',
  160.         "\xFB" => '&#971;',
  161.         "\xFC" => '&#972;',
  162.         "\xFD" => '&#973;',
  163.         "\xFE" => '&#974;',
  164.         "\xFF" => '&#65533;'
  165.     );
  166.  
  167.     $string str_replace(array_keys($cp1253)array_values($cp1253)$string);
  168.  
  169.     return $string;
  170. }

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