comparison roundup/rfc2822.py @ 1628:ea1afeb64b45

more pedantic rfc2822 header qp encoding
author Andrey Lebedev <kedder@users.sourceforge.net>
date Tue, 06 May 2003 21:49:20 +0000
parents 0634f815b90c
children fc52d57c6c3e 1d86402ce5e8
comparison
equal deleted inserted replaced
1627:e029d625c8f1 1628:ea1afeb64b45
1 import re 1 import re
2 from string import letters, digits
2 from binascii import b2a_base64, a2b_base64 3 from binascii import b2a_base64, a2b_base64
3 4
4 ecre = re.compile(r''' 5 ecre = re.compile(r'''
5 =\? # literal =? 6 =\? # literal =?
6 (?P<charset>[^?]*?) # non-greedy up to the next ? is the charset 7 (?P<charset>[^?]*?) # non-greedy up to the next ? is the charset
9 \? # literal ? 10 \? # literal ?
10 (?P<encoded>.*?) # non-greedy up to the next ?= is the encoded string 11 (?P<encoded>.*?) # non-greedy up to the next ?= is the encoded string
11 \?= # literal ?= 12 \?= # literal ?=
12 ''', re.VERBOSE | re.IGNORECASE) 13 ''', re.VERBOSE | re.IGNORECASE)
13 14
14 hqre = re.compile(r'^[-a-zA-Z0-9!*+/\[\]., ]+$') 15 hqre = re.compile(r'^[A-z0-9!"#$%%&\'()*+,-./:;<=>?@\[\]^_`{|}~ ]+$')
15 16
16 def base64_decode(s, convert_eols=None): 17 def base64_decode(s, convert_eols=None):
17 """Decode a raw base64 string. 18 """Decode a raw base64 string.
18 19
19 If convert_eols is set to a string value, all canonical email linefeeds, 20 If convert_eols is set to a string value, all canonical email linefeeds,

Roundup Issue Tracker: http://roundup-tracker.org/