Source for file cp1250.php

Documentation is available at cp1250.php

  1. <?php
  2.  
  3. /**
  4.  * decode/cp1250.php
  5.  *
  6.  * This file contains cp1250 decoding function that is needed to read
  7.  * cp1250 encoded mails in non-cp1250 locale.
  8.  *
  9.  * Original data taken from:
  10.  *  ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1250.TXT
  11.  *
  12.  *  Name:     cp1250 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: cp1250.php 14845 2020-01-07 08:09:34Z pdontthink $
  22.  * @package squirrelmail
  23.  * @subpackage decode
  24.  */
  25.  
  26. /**
  27.  * Decode a cp1250 string
  28.  * @param string $string Encoded string
  29.  * @return string $string Decoded string
  30.  */
  31. function charset_decode_cp1250 ($string{
  32.     // don't do decoding when there are no 8bit symbols
  33.     if (sq_is8bit($string,'windows-1250'))
  34.         return $string;
  35.  
  36.     $cp1250 array(
  37.         "\x80" => '&#8364;',
  38.         "\x81" => '&#65533;',
  39.         "\x82" => '&#8218;',
  40.         "\x83" => '&#65533;',
  41.         "\x84" => '&#8222;',
  42.         "\x85" => '&#8230;',
  43.         "\x86" => '&#8224;',
  44.         "\x87" => '&#8225;',
  45.         "\x88" => '&#65533;',
  46.         "\x89" => '&#8240;',
  47.         "\x8A" => '&#352;',
  48.         "\x8B" => '&#8249;',
  49.         "\x8C" => '&#346;',
  50.         "\x8D" => '&#356;',
  51.         "\x8E" => '&#381;',
  52.         "\x8F" => '&#377;',
  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" => '&#353;',
  64.         "\x9B" => '&#8250;',
  65.         "\x9C" => '&#347;',
  66.         "\x9D" => '&#357;',
  67.         "\x9E" => '&#382;',
  68.         "\x9F" => '&#378;',
  69.         "\xA0" => '&#160;',
  70.         "\xA1" => '&#711;',
  71.         "\xA2" => '&#728;',
  72.         "\xA3" => '&#321;',
  73.         "\xA4" => '&#164;',
  74.         "\xA5" => '&#260;',
  75.         "\xA6" => '&#166;',
  76.         "\xA7" => '&#167;',
  77.         "\xA8" => '&#168;',
  78.         "\xA9" => '&#169;',
  79.         "\xAA" => '&#350;',
  80.         "\xAB" => '&#171;',
  81.         "\xAC" => '&#172;',
  82.         "\xAD" => '&#173;',
  83.         "\xAE" => '&#174;',
  84.         "\xAF" => '&#379;',
  85.         "\xB0" => '&#176;',
  86.         "\xB1" => '&#177;',
  87.         "\xB2" => '&#731;',
  88.         "\xB3" => '&#322;',
  89.         "\xB4" => '&#180;',
  90.         "\xB5" => '&#181;',
  91.         "\xB6" => '&#182;',
  92.         "\xB7" => '&#183;',
  93.         "\xB8" => '&#184;',
  94.         "\xB9" => '&#261;',
  95.         "\xBA" => '&#351;',
  96.         "\xBB" => '&#187;',
  97.         "\xBC" => '&#317;',
  98.         "\xBD" => '&#733;',
  99.         "\xBE" => '&#318;',
  100.         "\xBF" => '&#380;',
  101.         "\xC0" => '&#340;',
  102.         "\xC1" => '&#193;',
  103.         "\xC2" => '&#194;',
  104.         "\xC3" => '&#258;',
  105.         "\xC4" => '&#196;',
  106.         "\xC5" => '&#313;',
  107.         "\xC6" => '&#262;',
  108.         "\xC7" => '&#199;',
  109.         "\xC8" => '&#268;',
  110.         "\xC9" => '&#201;',
  111.         "\xCA" => '&#280;',
  112.         "\xCB" => '&#203;',
  113.         "\xCC" => '&#282;',
  114.         "\xCD" => '&#205;',
  115.         "\xCE" => '&#206;',
  116.         "\xCF" => '&#270;',
  117.         "\xD0" => '&#272;',
  118.         "\xD1" => '&#323;',
  119.         "\xD2" => '&#327;',
  120.         "\xD3" => '&#211;',
  121.         "\xD4" => '&#212;',
  122.         "\xD5" => '&#336;',
  123.         "\xD6" => '&#214;',
  124.         "\xD7" => '&#215;',
  125.         "\xD8" => '&#344;',
  126.         "\xD9" => '&#366;',
  127.         "\xDA" => '&#218;',
  128.         "\xDB" => '&#368;',
  129.         "\xDC" => '&#220;',
  130.         "\xDD" => '&#221;',
  131.         "\xDE" => '&#354;',
  132.         "\xDF" => '&#223;',
  133.         "\xE0" => '&#341;',
  134.         "\xE1" => '&#225;',
  135.         "\xE2" => '&#226;',
  136.         "\xE3" => '&#259;',
  137.         "\xE4" => '&#228;',
  138.         "\xE5" => '&#314;',
  139.         "\xE6" => '&#263;',
  140.         "\xE7" => '&#231;',
  141.         "\xE8" => '&#269;',
  142.         "\xE9" => '&#233;',
  143.         "\xEA" => '&#281;',
  144.         "\xEB" => '&#235;',
  145.         "\xEC" => '&#283;',
  146.         "\xED" => '&#237;',
  147.         "\xEE" => '&#238;',
  148.         "\xEF" => '&#271;',
  149.         "\xF0" => '&#273;',
  150.         "\xF1" => '&#324;',
  151.         "\xF2" => '&#328;',
  152.         "\xF3" => '&#243;',
  153.         "\xF4" => '&#244;',
  154.         "\xF5" => '&#337;',
  155.         "\xF6" => '&#246;',
  156.         "\xF7" => '&#247;',
  157.         "\xF8" => '&#345;',
  158.         "\xF9" => '&#367;',
  159.         "\xFA" => '&#250;',
  160.         "\xFB" => '&#369;',
  161.         "\xFC" => '&#252;',
  162.         "\xFD" => '&#253;',
  163.         "\xFE" => '&#355;',
  164.         "\xFF" => '&#729;'
  165.     );
  166.  
  167.     $string str_replace(array_keys($cp1250)array_values($cp1250)$string);
  168.  
  169.     return $string;
  170. }

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