[Vobject] importing UTF-8 text - UnicodeDecodeError

Jeffrey Harris jeffrey at skyhouseconsulting.com
Tue Mar 16 09:54:15 CDT 2010


Hi Erik,

>      This is my first post, so I hope it's not a foolish one.  I did
> google around and try to find the answer on my own but am still
> stumped.  I've encountered something strange with vevents, and am not
> sure whether it's a bug or a design decision that I don't understand.

Well, Markmail doesn't seem to know anything about transformToNative, so I wouldn't expect you to, either.

If I really wanted to avoid people asking the same question, I'd write an FAQ. Somehow I never get to it...

>      This has been driving me crazy all day.  Hopefully someone wiser
> can either confirm that I'm right, or point out what I'm doing and/or
> thinking wrong.


You are right, your vevent is different. Here are the phases vobject uses to parse an object:

0. Decode UTF-8 into unicode
1. Parse contentline syntax into a tree
2. Assign a behavior to each node if one can be found
3. Decode encoded data (base64, or quoted-printable)
4. Transform from a naive text representation to any complex representation the behavior defines

To serialize, this process runs in reverse.

The VEventBehavior is special, in that it actually changes the __class__ of its associated node from Component to RecurringComponent when its transformToNative method is called

Anyway, basically, what you need to add is:

new_ev_object.transformToNative()

Sincerely,
Jeffrey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.skyhouseconsulting.com/pipermail/vobject/attachments/20100316/0cc5713c/attachment.htm 


More information about the VObject mailing list