4 * functions/decode/us_ascii.php
6 * Copyright (c) 2004 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * This file contains us-ascii decoding function that is needed to read
10 * us-ascii encoded mails in non-us-ascii locale.
12 * Function replaces all 8bit symbols with '?' marks
15 * @package squirrelmail
20 * us-ascii decoding function.
22 * @param string $string string that has to be cleaned
23 * @return string cleaned string
25 function charset_decode_us_ascii ($string) {
26 global $default_charset;
28 if (strtolower($default_charset) == 'us-ascii')
31 // don't do decoding when there are no 8bit symbols
32 if (! sq_is8bit($string,'us-ascii'))
35 $string = preg_replace("/([\201-\237])/e","'?'",$string);
37 /* I don't want to use 0xA0 (\240) in any ranges. RH73 may dislike it */
38 $string = str_replace("\240", '?', $string);
40 $string = preg_replace("/([\241-\377])/e","'?'",$string);