4 * functions/decode/us_ascii.php
6 * This file contains us-ascii decoding function that is needed to read
7 * us-ascii encoded mails in non-us-ascii locale.
9 * Function replaces all 8bit symbols with '?' marks
11 * @copyright © 2004-2009 The SquirrelMail Project Team
12 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
14 * @package squirrelmail
19 * us-ascii decoding function.
21 * @param string $string string that has to be cleaned
22 * @return string cleaned string
24 function charset_decode_us_ascii ($string) {
25 // don't do decoding when there are no 8bit symbols
26 if (! sq_is8bit($string,'us-ascii'))
29 $string = preg_replace("/([\201-\237])/e","'?'",$string);
31 /* I don't want to use 0xA0 (\240) in any ranges. RH73 may dislike it */
32 $string = str_replace("\240", '?', $string);
34 $string = preg_replace("/([\241-\377])/e","'?'",$string);