Source for file iso_8859_1.php

Documentation is available at iso_8859_1.php

  1. <?php
  2.  
  3. /**
  4.  * decode/iso8859-1.php
  5.  *
  6.  * This file contains iso-8859-1 decoding function that is needed to read
  7.  * iso-8859-1 encoded mails in non-iso-8859-1 locale.
  8.  *
  9.  * @copyright 2003-2020 The SquirrelMail Project Team
  10.  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  11.  * @version $Id: iso_8859_1.php 14840 2020-01-07 07:42:38Z pdontthink $
  12.  * @package squirrelmail
  13.  * @subpackage decode
  14.  */
  15.  
  16. /**
  17.  * Decode iso8859-1 string
  18.  * @param string $string Encoded string
  19.  * @return string $string Decoded string
  20.  */
  21. function charset_decode_iso_8859_1 ($string{
  22.     // don't do decoding when there are no 8bit symbols
  23.     if (sq_is8bit($string,'iso-8859-1'))
  24.         return $string;
  25.  
  26.     $string preg_replace_callback("/([\201-\237])/",
  27.     create_function ('$matches''return \'&#\' . ord($matches[1]) . \';\';'),
  28.     $string);
  29.  
  30.     /* I don't want to use 0xA0 (\240) in any ranges. RH73 may dislike it */
  31.     $string str_replace("\240"'&#160;'$string);
  32.  
  33.     $string preg_replace_callback("/([\241-\377])/",
  34.     create_function ('$matches''return \'&#\' . ord($matches[1]) . \';\';'),
  35.     $string);
  36.     return $string;
  37. }

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