[Vobject] Encoding Problems

Jeffrey Harris jeffrey at skyhouseconsulting.com
Sun Jan 29 20:08:17 CST 2006


Hi Benjamin,

I've gone ahead and added unicode escaping to prettyPrint as of revision
117.

> I just stumbled across vobject b/c I wanted to update my contact's
> birthdays which are saved as events in an ical file
> into the birthday fields of the contacts vcards.
>
> One of my first steps was to print out the information from the file
> which went quite well when I did it in the
> terminal. As soon as i tried to pipe or redirect it to another
> programm or into a file i got this:

I'm a little surprised you're wanting to save the output of prettyPrint
to a file, I think of this mostly as a debugging tool.  But if you find
it useful, great!

> I replaced line 240 with the following (borrowed idea from __str__): 
> print pre, self.name + ":", unicode(self.value).encode('ascii',
> 'replace') and all was fine again - but the new file was ascii, not
> unicode like the source :(
> 
> Could someone look into this? I have no clue, as I am completely new
> to Python

The Python console can't handle non-ASCII characters, but your final
output needn't print to the console, you can just write your output to a
file.

To help, I'd need to know in more detail what you're trying to do.

Sincerely,
Jeffrey


More information about the VObject mailing list