A UnicodeEncodeError exception will be raised if a unicode object is converted to a string, but the default encoding (or the explicit encoding used) does not support a character that is present in the unicode object. For example:

    >>> title=u"Hello \u00E1"
    >>>
    >>> str(title)
    Traceback (most recent call last):
      File "<stdin>", line 1, in ?
    UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 6: ordinal not in range(128)
    >>> print title.encode("latin1")
    Hello รก
    >>>

UnicodeEncodeError (last edited 2008-03-11 10:50:29 by localhost)

NOTE: To edit pages in this wiki you must be a member of the TrustedEditorsGroup.