Package ProcImap :: Package Utils :: Module Processing
[hide private]
[frames] | no frames]

Module Processing

source code

This module contains general functions for processing mail locally e.g. for filtering and classification.

Classes [hide private]
  AddressListFile
This class wraps around a file containing emailadresses.
  ReplacementListFile
This class wraps around a file containing email address replacements.
Functions [hide private]
 
pipe_message(message, command)
Pipe the message through a shell command: cat message | commmand > message message is assumed to be an instance of ImapMessage Returns modified message as instance of ImapMessage
source code
 
unknown_to_ascii(inputstring)
This takes a string or unicode string in unknown encoding, tries to guess the encoding and to replace Latin-1 characters with something equivalent in 7-bit ASCII.
source code
 
put_through_pager(displaystring, pager='less')
Put displaystring through the 'less' pager
source code
 
references_from_header(header)
Extract the message ids from the "References" and "In-Reply-To" Headers.
source code
Function Details [hide private]

unknown_to_ascii(inputstring)

source code 

This takes a string or unicode string in unknown encoding, tries to guess the encoding and to replace Latin-1 characters with something equivalent in 7-bit ASCII. Decoding an unknown string is based on heuristics. This function may return complete garbage. The function returns a plain ASCII string, making a best effort to convert Latin-1 characters into ASCII equivalents. It does not just strip out the Latin-1 characters. All characters in the standard 7-bit ASCII range are preserved. In the 8th bit range all the Latin-1 accented letters are converted to unaccented equivalents. Most symbol characters are converted to something meaningful. Anything not converted is deleted.

Adapted from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/251871