Can Python fix vcard files?

skip at pobox.com skip at pobox.com
Tue Oct 14 06:45:07 EDT 2008


    >> 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.

Skip




More information about the Python-list mailing list