[Vobject] problem with QUOTED-PRINTABLE

Francois du Toit fpdutoit.lists at gmail.com
Fri Jul 6 12:53:17 CDT 2007


I attached a sample .vcf and python script thats giving me problems. I'm 
getting the following error:

Traceback (most recent call last):
   File "/home/ivanova/bin/vcard_sane.py", line 17, in ?
     print i.serialize()
   File "build/bdist.linux-i686/egg/vobject/base.py", line 189, in serialize
   File "build/bdist.linux-i686/egg/vobject/base.py", line 878, in 
defaultSerialize
   File "build/bdist.linux-i686/egg/vobject/base.py", line 189, in serialize
   File "build/bdist.linux-i686/egg/vobject/base.py", line 895, in 
defaultSerialize
   File "build/bdist.linux-i686/egg/vobject/base.py", line 857, in 
foldOneLine
   File "/usr/lib/python2.4/StringIO.py", line 107, in seek
     self.buf += ''.join(self.buflist)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 1: 
ordinal not in range(128)


-------------- next part --------------
#!/usr/bin/python

import vobject, codecs, quopri

f = open('/tmp/testing.vcf')
string = f.read()
f.close()

#uncomment these lines and it works
#string = string.replace(';ENCODING=QUOTED-PRINTABLE','')
#string = quopri.decodestring(string)

pb = vobject.readComponents(string)


for i in pb:
    print i.n.value
    print i.serialize()



-------------- next part --------------
A non-text attachment was scrubbed...
Name: testing.vcf
Type: text/x-vcard
Size: 121 bytes
Desc: not available
Url : http://lists.skyhouseconsulting.com/pipermail/vobject/attachments/20070706/e8cd68f1/testing.vcf


More information about the VObject mailing list