Can Python fix vcard files?

Dotan Cohen dotancohen at gmail.com
Tue Oct 14 09:21:49 EDT 2008


2008/10/14  <skip at pobox.com>:
>
>    >> One question, though, is that code unicode-safe in the event that
>    >> there are unicode characters in there?
>
>    Terry> I believe that particular find/replace should be safe even if
>    Terry> other bytes represent encoded unicode.
>
> Ah, I misread the original question.  I thought he was referring to Unicode
> filenames.  Yes, everything you read using Python 2.x will essentially be
> raw bytes.  You should thus have no problems reading or writing them.  It
> would only be a problem if your "cooked" strings were converted to Unicode
> objects.  In that case you'd need to tell Python how to encode them as bytes
> for writing on-disk.
>

The filenames _could_ be Unicode. Kontact exports the name of the
vcard as the Display Name of the contact, and in many cases there will
be Unicode characters in the filenames.

-- 
Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

ä-ö-ü-ß-Ä-Ö-Ü


More information about the Python-list mailing list