[Vobject] importing UTF-8 text - UnicodeDecodeError

Jeffrey Harris jeffrey at skyhouseconsulting.com
Wed Mar 17 16:06:59 CDT 2010


Hi Matthew,

I think this is a good candidate for moving the discussion to StackOverflow (which is excellent, if you haven't tried it). I'd need to see more code to see what's going wrong, and email isn't the best medium for that.

Basically, before you feed data to csv.reader, you want to be recoding from UTF-16-le to UTF-8, which you could do manually or using codecs.StreamRecoder. It sounds like you're doing that, though, so again, the question "How do I parse UTF-16-le encoded csv into Unicode cells" would be an excellent question for StackOverflow (with the relevant code sample).  I'll answer it there later (although I imagine a dozen people will beat me to it).

If you've got that working, and there's something going wrong in vobject, it would be good to add a few asserts that the data you're assigning to vobject ContentLine values is actually unicode. Let me know if this approach doesn't solve your problem.

Sincerely,
Jeffrey


More information about the VObject mailing list