mò &U²Ic@sÓdkZdkZdklZdZdZdZdZdZ hdeee f<deee f<d eee f<d eee f<d eee f<d eee f<d eee f<deee f<deee f<deee f<deee f<de e e f<deee f<deee f<dee df<dee df<dee e f<deee f<deedf<de edfAdd character set properties to the global registry. charset is the input character set, and must be the canonical name of a character set. Optional header_enc and body_enc is either Charset.QP for quoted-printable, Charset.BASE64 for base64 encoding, Charset.SHORTEST for the shortest of qp or base64 encoding, or None for no encoding. SHORTEST is only valid for header_enc. It describes how message headers and message bodies in the input charset are to be encoded. Default is no encoding. Optional output_charset is the character set that the output should be in. Conversions will proceed from input charset, to Unicode, to the output charset when the method Charset.convert() is called. The default is to output in the same character set as the input. Both input_charset and output_charset must have Unicode codec entries in the module's charset-to-codec mapping; use add_codec(charset, codecname) to add codecs the module does not know about. See the codecs module's documentation for more information. s!SHORTEST not allowed for body_encN(tbody_enctSHORTESTt ValueErrort header_enctoutput_charsettCHARSETStcharset(RRRR((t*/data/zmath/lib/python2.4/email/Charset.pyt add_charset_s cCs|t|((Rtconvertós cCs]t|tƒp|idjo|Snyt||idƒSWntj o |SnXdS(sêConvert a possibly multibyte string to a safely splittable format. Uses the input_codec to try and convert the string to Unicode, so it can be safely split on character boundaries (even for multibyte characters). Returns the string as-is if it isn't known how to convert it to Unicode with the input_charset. Characters that could not be converted to Unicode will be replaced with the Unicode replacement character U+FFFD. treplaceN(t isinstanceR>R%R)R1R+t LookupError(R)R>((Rt to_splittableús  cCsu|o |i}n |i}t|tƒ p |djo|Sny|i |dƒSWnt j o |SnXdS(s*Convert a splittable string back into an encoded string. Uses the proper codec to try and convert the string from Unicode back into an encoded format. Return the string as-is if it is not Unicode, or if it could not be converted from Unicode. Characters that could not be converted from Unicode will be replaced with an appropriate character (usually '?'). If to_output is True (the default), uses output_codec to convert to an encoded format. If to_output is False, uses input_codec. RAN( t to_outputR)R2tcodecR1RBtustrR%R+R?RC(R)RGRERF((Rtfrom_splittables   cCs|ip|iS(sReturn the output character set. This is self.output_charset if that is not None, otherwise it is self.input_charset. N(R)RR&(R)((Rtget_output_charset)scCsÑ|iƒ}|itjo"tii|ƒt |ƒt Sn|it jo"ti i |ƒt |ƒt Sn^|itjoCtii|ƒ}ti i |ƒ}t||ƒt |ƒt Sn t |ƒSdS(s/Return the length of the encoded header string.N(R)RItcsetR/R*temailt base64MIMEt base64_lenR>tlentMISC_LENR;t quopriMIMEtheader_quopri_lenRtlenb64tlenqptmin(R)R>RJRSRR((Rtencoded_header_len1s ""cCs÷|iƒ}|o|i|ƒ}n|itjotii ||ƒSn§|it joti i ||ddƒSnz|it joetii|ƒ}ti i|ƒ}||jotii ||ƒSqóti i ||ddƒSn|SdS(sEHeader-encode a string, optionally converting it to output_charset. If convert is True, the string will be converted from the input charset to the output charset automatically. This is not useful for multibyte character sets, which have line length issues (multibyte characters must be split on a character, not a byte boundary); use the high-level Header class to deal with these issues. convert defaults to False. The type of encoding (base64 or quoted-printable) will be based on self.header_encoding. t maxlinelenN(R)RIRJR@R>R/R*RKRLt header_encodeR;RPR+RRMRRRQRS(R)R>R@RJRSRR((RRW@s   cCsj|o|i|ƒ}n|itjotii|ƒSn)|itjoti i|ƒSn|SdS(sÉBody-encode a string and convert it to output_charset. If convert is True (the default), the string will be converted from the input charset to output charset automatically. Unlike header_encode(), there are no issues with byte boundaries and multibyte charsets in email bodies, so this is usually pretty safe. The type of encoding (base64 or quoted-printable) will be based on self.body_encoding. N( R@R)R>R0R*RKRLt body_encodeR;RP(R)R>R@((RRX_s (t__name__t __module__t__doc__tDEFAULT_CHARSETR3R4t__repr__R7R8R=R@RDtTrueRHRIRUtFalseRWRX(((RR$s +           (temail.base64MIMERKtemail.quopriMIMEtemail.EncodersR<R;R*RROR\R+RRR"RR R#R$(R;RR\R<R#R*ROR"R RR$RKRR((Rt?s   ÿo Ì!