Open respiranto opened 2 months ago
I started doing things: https://github.com/respiranto/roundcubemail/commits/devel-vcard-sabre-vobject
Question 1: How should / can I report errors on parsing?
load()
; should generally be from the database),import()
ing (generally from a user provided vCard file).For (b), I'd like to cause a user-visible message like "Failed importing $person_name", "Failed importing record without name or e-mail address ($record_data)", "Failed importing vCard due to unsupported encoding".
Question 2 (backslash handling): Would it be OK to break #4189 (and Roundcube\Tests\Framework\VCardTest::test_parse_five
)?
\:
becomes :
).
\\
), except by working on the raw input (which I very much would like to avoid).Question 3 (charset support): Would it be OK to reduce the set of supported charsets to that supported by sabre/vobject?
Roundcube\Tests\Framework\VCardTest::test_import
.Suggestion 4 (charset support): Restrict document charset to (and assume) UTF-8.
CHARSET
parameter would still be respected (for v2.1; v3.0 and v4.0 do not define it).detect_charset()
heuristic, which may give wrong results.rcube_addressbook::set_error()
and friends.Testing:
:
by \:
.:
unchanged, \:
correctly encoded as \\:
.GMail example:
BEGIN:VCARD
VERSION:3.0
FN:Jane Doé
N:Doé;Jane;;;
item1.URL:https\://example.org/
item1.X-ABLabel:
NOTE:noté\\\:foo\:bar
CATEGORIES:myContacts
END:VCARD
Thunderbird example:
BEGIN:VCARD
VERSION:4.0
N:Doé;Jane;;;
FN:Jane Doé
NOTE:noté:foo\\:bar
UID:fdc25d89-21a0-4069-a93f-2d1a13a6260c
URL:http://exampe.org
END:VCARD
Note that I have found 15 issues (mostly bugs) for sabre/vobject so far, all of which we should be able to work with, some of which may require workarounds.
@respiranto Wow, I'm impressed! Thank you very much already! (I'm currently mostly distracted by other topics, unfortunately, so for me it might take a while to react to questions.)
The vCard code currently has its own custom vCard parser. There are many issues with the current code and I deemed it better to use an external library, sabre/vobject being the apparently best choice.
See in particular the bug report #9593.
This may also help to address #9590.