Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | ##---------------------------------------------------------------------------## |
2 | ## File: | |
3 | ## $Id: qprint.pl,v 2.5 2001/09/17 16:09:32 ehood Exp $ | |
4 | ## Authors: | |
5 | ## Earl Hood mhonarc@mhonarc.org | |
6 | ## Alan Barrett barrett@daisy.ee.und.ac.za | |
7 | ## Description: | |
8 | ## This library defines the routine to decode "quoted-printable" | |
9 | ## encoded data. | |
10 | ## Usage: | |
11 | ## require "quoted_printable.pl"; | |
12 | ## $text = "ed_printable'qprdecode($data); | |
13 | ## | |
14 | ##---------------------------------------------------------------------------## | |
15 | ## Copyright (C) 1995-1999 Earl Hood, mhonarc@mhonarc.org | |
16 | ## | |
17 | ## This program is free software; you can redistribute it and/or modify | |
18 | ## it under the terms of the GNU General Public License as published by | |
19 | ## the Free Software Foundation; either version 2 of the License, or | |
20 | ## (at your option) any later version. | |
21 | ## | |
22 | ## This program is distributed in the hope that it will be useful, | |
23 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of | |
24 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
25 | ## GNU General Public License for more details. | |
26 | ## | |
27 | ## You should have received a copy of the GNU General Public License | |
28 | ## along with this program; if not, write to the Free Software | |
29 | ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
30 | ##---------------------------------------------------------------------------## | |
31 | ||
32 | ||
33 | package quoted_printable; | |
34 | ||
35 | sub qprdecode { | |
36 | local($_) = shift; | |
37 | ||
38 | s/[^\S\r\n]*(\r?\n)/$1/g; # remove trailing whitespace on each line | |
39 | s/\=\r?\n//g; # remove soft linebreaks | |
40 | s/=([0-9A-F]{2})/pack("H2",$1)/ge; # convert hex codes | |
41 | $_; # return result | |
42 | } | |
43 | ||
44 | 1; |