File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 354354Parameter keys are always compared case insensitively. The return
355355value can either be a string, or a 3-tuple if the parameter was
356356\rfc {2231} encoded. When it's a 3-tuple, the elements of the value are of
357- the form \code {(CHARSET, LANGUAGE, VALUE)}, where \code {LANGUAGE} may
358- be the empty string. Your application should be prepared to deal with
359- 3-tuple return values, which it can convert to a Unicode string like
360- so:
357+ the form \code {(CHARSET, LANGUAGE, VALUE)}. Note that both \code {CHARSET} and
358+ \code {LANGUAGE} can be \code {None}, in which case you should consider
359+ \code {VALUE} to be encoded in the \code {us-ascii} charset. You can
360+ usually ignore \code {LANGUAGE}.
361+
362+ Your application should be prepared to deal with 3-tuple return
363+ values, and can convert the parameter to a Unicode string like so:
361364
362365\begin {verbatim }
363366param = msg.get_param('foo')
364367if isinstance(param, tuple):
365- param = unicode(param[2], param[0])
368+ param = unicode(param[2], param[0] or 'us-ascii' )
366369\end {verbatim }
367370
368371In any case, the parameter value (either the returned string, or the
You can’t perform that action at this time.
0 commit comments