Module quopri
[hide private]
[frames] | no frames]

Module quopri

Conversions to/from quoted-printable transport encoding as per RFC 1521.

Functions [hide private]
 
needsquoting(c, quotetabs, header)
Decide whether a particular character needs to be quoted.
 
quote(c)
Quote a single character.
 
encode(input, output, quotetabs, header=0)
Read 'input', apply quoted-printable encoding, and write to 'output'.
 
encodestring(s, quotetabs=0, header=0)
 
decode(input, output, header=0)
Read 'input', apply quoted-printable decoding, and write to 'output'.
 
decodestring(s, header=0)
 
ishex(c)
Return true if the character 'c' is a hexadecimal digit.
 
unhex(s)
Get the integer value of a hexadecimal number.
 
main()
Variables [hide private]
  ESCAPE = '='
  MAXLINESIZE = 76
  HEX = '0123456789ABCDEF'
  EMPTYSTRING = ''

Imports: a2b_qp, b2a_qp


Function Details [hide private]

needsquoting(c, quotetabs, header)

 

Decide whether a particular character needs to be quoted.

The 'quotetabs' flag indicates whether embedded tabs and spaces should be quoted. Note that line-ending tabs and spaces are always encoded, as per RFC 1521.

encode(input, output, quotetabs, header=0)

 

Read 'input', apply quoted-printable encoding, and write to 'output'.

'input' and 'output' are files with readline() and write() methods. The 'quotetabs' flag indicates whether embedded tabs and spaces should be quoted. Note that line-ending tabs and spaces are always encoded, as per RFC 1521. The 'header' flag indicates whether we are encoding spaces as _ as per RFC 1522.

decode(input, output, header=0)

 

Read 'input', apply quoted-printable decoding, and write to 'output'. 'input' and 'output' are files with readline() and write() methods. If 'header' is true, decode underscore as space (per RFC 1522).