On Wed, Sep 24, 2008 at 10:14 AM, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:

>
> I'm creating some RTF pages using pyRTF. Unfortunately, it doesn't
> appear to support unicode, and I keep throwing UnicodeEncodeError. Is
> there a way to de-unicode the data I'm passing to it or something?
>

The way to go from a unicode type to a bytestring is to call encode() on the
unicode type.  You have to choose an appropriate encoding for the resulting
bytestring.  'utf-8' may be appropriate but I know nothing of pyRTF so can't
say for sure.  The error you are seeing usually results from an attempt to
encode to 'ascii'  (the default when you say str(unicode_type)) when the
data you have in your unicode_type has no ascii representation.

Karen

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to