kcd icon indicating copy to clipboard operation
kcd copied to clipboard

Contacts: FN values stored with vCard 2.1 quoted-printable encoding intact (=44=61=76...)

Open ekollof opened this issue 2 months ago • 1 comments

Summary

Contacts synced from a phone that emits vCard 2.1 with ENCODING=QUOTED-PRINTABLE (common for non-ASCII/emoji display names) are stored and served with the QP byte-escapes intact. kcd contacts list and contacts list --json show raw =XX sequences instead of decoded names.

Evidence (kcd 1.19.0, Pixel 10a, KDE Connect Android 1.35.16)

kcd contacts list --json <id> (names as stored by the contacts plugin):

"=44=61=76=C3=AD=64=20=49=72=65=6C=61=6E=64"          (should be "David Íreland")
"=49=63=61=74=C3=BA=20=4A=6F=75=73=6D=61"
"=4D=61=72=63=65=6C=20=44=E2=80=99=48=61=6E=69=73"
"=50=61=74=20=F0=9F=92=AA=..."                        (emoji names)
"\=F0=9D=95=B0=..." (math digits)

5 of 141 contacts affected — every contact whose vCard used quoted-printable. ASCII-only names decode fine, which matches parseVCard() taking the raw FN value with no RFC 2045 QP decoding (v1.19.0 internal/plugins/contacts/vcard.go; also no handling of ENCODING=QUOTED-PRINTABLE / CHARSET=UTF-8 parameters on the FN line).

Suggested fix

In parseVCard, when a line's field parameters include ENCODING=QUOTED-PRINTABLE, QP-decode the value (RFC 2045: =XX hex pairs; soft line breaks = at end of unfolded line) before cleanDisplayValue. CHAR-SET, when present, is UTF-8 on current Android stacks; plain byte-as-UTF8 decoding is safe.

ekollof avatar Sep 19 '26 16:09 ekollof

Thanks for the report, confirmed and fixed on v1.19.1.

QP-encoded FN values are now decoded before display cleanup. Malformed escapes fall back to the raw value rather than dropping the contact. In case of any issues feel free to report it.

bethropolis avatar Sep 21 '26 02:09 bethropolis