Open jkirk opened 5 years ago
We're seeing the same issue with a lot of VCards in the wild.
Does allowQP=True
fix the parse error?
@olafhering Well, kind of 'better':
% python
Python 3.7.3 (default, Dec 20 2019, 18:57:59)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import vobject
>>> t = """
... BEGIN:VCARD
... VERSION:2.1
... N:Muster;Max;;;
... FN:Max Muster
... ADR;WORK;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:;;=65=66=
... =31=37=30=31=;;;;
... END:VCARD
... """
>>> v = vobject.readOne(t, allowQP = True)
>>> v.prettyPrint()
VCARD
VERSION: 2.1
N: Max Muster
FN: Max Muster
ADR: ef1701=
,
params for ADR:
CHARSET ['UTF-8']
The output is quite similar to what happened when I manually merged the line, but here a =
sign is appended to the address line. And still ,
is added in new line.
(Somehow unrelated to this issue, but worth mentioning: N: Max Muster
consists of two white spaces between first name and surname and between N:
and first name. Yes, Gitlab only shows one white space in between in the previous sentence, see the code above.)
Does
allowQP=True
fix the parse error?
At line 45: Failed to parse line: =DB=8C
I had a similar problem and this parameter fixed it
thanks!
My Android phone exports my contact (list) / address book into a vcf file. Some of them have entries like this (an "utf-8 encoded printable" string on its own) where vobjects fails to parse the extra line:
Please note that the (source) address field has no newline (and if it had one it would have been quoted with
=0A=
) and that this example is simplified, the actual line gets broken after about 23 "utf quotes" (some characters consists of two "utf quotes" likeß
==C3=9F=
)."Merging" the lines (I removed the leading and the last
=
of the extra line) like this lead to the following:Please notice the
,
in the extra line. Why is that?I've copy/pasted and anonymized the content from the vcf which was in "fileformat" dos. The same happens if read the file. I am using Debian/stretch and running vobject in pip environment.