Source for file cp1255.php

Documentation is available at cp1255.php

  1. <?php
  2.  
  3. /**
  4.  * decode/cp1255.php
  5.  *
  6.  * This file contains cp1255 decoding function that is needed to read
  7.  * cp1255 encoded mails in non-cp1255 locale.
  8.  *
  9.  * Original data taken from:
  10.  *  ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1255.TXT
  11.  *
  12.  *   Name:     cp1255 to Unicode table
  13.  *   Unicode version: 2.0
  14.  *   Table version: 2.01
  15.  *   Table format:  Format A
  16.  *   Date:          1/7/2000
  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: cp1255.php 14840 2020-01-07 07:42:38Z pdontthink $
  22.  * @package squirrelmail
  23.  * @subpackage decode
  24.  */
  25.  
  26. /**
  27.  * Decode cp1255-encoded string
  28.  * @param string $string Encoded string
  29.  * @return string $string decoded string
  30.  */
  31. function charset_decode_cp1255 ($string{
  32.     // don't do decoding when there are no 8bit symbols
  33.     if (sq_is8bit($string,'windows-1255'))
  34.         return $string;
  35.  
  36.     $cp1255 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" => '&#710;',
  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" => '&#732;',
  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" => '&#161;',
  71.         "\xA2" => '&#162;',
  72.         "\xA3" => '&#163;',
  73.         "\xA4" => '&#8362;',
  74.         "\xA5" => '&#165;',
  75.         "\xA6" => '&#166;',
  76.         "\xA7" => '&#167;',
  77.         "\xA8" => '&#168;',
  78.         "\xA9" => '&#169;',
  79.         "\xAA" => '&#215;',
  80.         "\xAB" => '&#171;',
  81.         "\xAC" => '&#172;',
  82.         "\xAD" => '&#173;',
  83.         "\xAE" => '&#174;',
  84.         "\xAF" => '&#175;',
  85.         "\xB0" => '&#176;',
  86.         "\xB1" => '&#177;',
  87.         "\xB2" => '&#178;',
  88.         "\xB3" => '&#179;',
  89.         "\xB4" => '&#180;',
  90.         "\xB5" => '&#181;',
  91.         "\xB6" => '&#182;',
  92.         "\xB7" => '&#183;',
  93.         "\xB8" => '&#184;',
  94.         "\xB9" => '&#185;',
  95.         "\xBA" => '&#247;',
  96.         "\xBB" => '&#187;',
  97.         "\xBC" => '&#188;',
  98.         "\xBD" => '&#189;',
  99.         "\xBE" => '&#190;',
  100.         "\xBF" => '&#191;',
  101.         "\xC0" => '&#1456;',
  102.         "\xC1" => '&#1457;',
  103.         "\xC2" => '&#1458;',
  104.         "\xC3" => '&#1459;',
  105.         "\xC4" => '&#1460;',
  106.         "\xC5" => '&#1461;',
  107.         "\xC6" => '&#1462;',
  108.         "\xC7" => '&#1463;',
  109.         "\xC8" => '&#1464;',
  110.         "\xC9" => '&#1465;',
  111.         "\xCA" => '&#65533;',
  112.         "\xCB" => '&#1467;',
  113.         "\xCC" => '&#1468;',
  114.         "\xCD" => '&#1469;',
  115.         "\xCE" => '&#1470;',
  116.         "\xCF" => '&#1471;',
  117.         "\xD0" => '&#1472;',
  118.         "\xD1" => '&#1473;',
  119.         "\xD2" => '&#1474;',
  120.         "\xD3" => '&#1475;',
  121.         "\xD4" => '&#1520;',
  122.         "\xD5" => '&#1521;',
  123.         "\xD6" => '&#1522;',
  124.         "\xD7" => '&#1523;',
  125.         "\xD8" => '&#1524;',
  126.         "\xD9" => '&#65533;',
  127.         "\xDA" => '&#65533;',
  128.         "\xDB" => '&#65533;',
  129.         "\xDC" => '&#65533;',
  130.         "\xDD" => '&#65533;',
  131.         "\xDE" => '&#65533;',
  132.         "\xDF" => '&#65533;',
  133.         "\xE0" => '&#1488;',
  134.         "\xE1" => '&#1489;',
  135.         "\xE2" => '&#1490;',
  136.         "\xE3" => '&#1491;',
  137.         "\xE4" => '&#1492;',
  138.         "\xE5" => '&#1493;',
  139.         "\xE6" => '&#1494;',
  140.         "\xE7" => '&#1495;',
  141.         "\xE8" => '&#1496;',
  142.         "\xE9" => '&#1497;',
  143.         "\xEA" => '&#1498;',
  144.         "\xEB" => '&#1499;',
  145.         "\xEC" => '&#1500;',
  146.         "\xED" => '&#1501;',
  147.         "\xEE" => '&#1502;',
  148.         "\xEF" => '&#1503;',
  149.         "\xF0" => '&#1504;',
  150.         "\xF1" => '&#1505;',
  151.         "\xF2" => '&#1506;',
  152.         "\xF3" => '&#1507;',
  153.         "\xF4" => '&#1508;',
  154.         "\xF5" => '&#1509;',
  155.         "\xF6" => '&#1510;',
  156.         "\xF7" => '&#1511;',
  157.         "\xF8" => '&#1512;',
  158.         "\xF9" => '&#1513;',
  159.         "\xFA" => '&#1514;',
  160.         "\xFB" => '&#65533;',
  161.         "\xFC" => '&#65533;',
  162.         "\xFD" => '&#8206;',
  163.         "\xFE" => '&#8207;',
  164.         "\xFF" => '&#65533;'
  165.     );
  166.  
  167.     $string str_replace(array_keys($cp1255)array_values($cp1255)$string);
  168.  
  169.     return $string;
  170. }

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