There are too many modified files being committed without the copyright year being...
[squirrelmail.git] / functions / decode / us_ascii.php
CommitLineData
d5bb4a01 1<?php
2
3/**
4 * functions/decode/us_ascii.php
5 *
d5bb4a01 6 * This file contains us-ascii decoding function that is needed to read
7 * us-ascii encoded mails in non-us-ascii locale.
8 *
9 * Function replaces all 8bit symbols with '?' marks
10 *
d4e46166 11 * @copyright &copy; 2004-2009 The SquirrelMail Project Team
4b4abf93 12 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
31841a9e 13 * @version $Id$
d5bb4a01 14 * @package squirrelmail
15 * @subpackage decode
16 */
17
18/**
19 * us-ascii decoding function.
20 *
21 * @param string $string string that has to be cleaned
22 * @return string cleaned string
23 */
24function charset_decode_us_ascii ($string) {
e53c9681 25 // don't do decoding when there are no 8bit symbols
26 if (! sq_is8bit($string,'us-ascii'))
d5bb4a01 27 return $string;
28
29 $string = preg_replace("/([\201-\237])/e","'?'",$string);
30
31 /* I don't want to use 0xA0 (\240) in any ranges. RH73 may dislike it */
32 $string = str_replace("\240", '?', $string);
33
34 $string = preg_replace("/([\241-\377])/e","'?'",$string);
35 return $string;
36}