Open haphi opened 11 years ago
Sorry for getting back to this so late. This really shouldn't happen, since all embedded images should be base64 encoded. I'm not really sure if just ignoring it (like in your pull request) is the best way to deal with this. Do you know which application created this vcard ? and do other applications display the image correctly?
I only have two vcards with "PHOTO"-properties, in both cases binary encoded. One was created by an android phone an synced through an OwnCloud-server, the other one has some 'history', that I cannot really trace back anymore. I thought ignoring at that point in the code would be OK as there is no good way to pretty-print non-printable data. Of course, come to think of it, instead of dropping the field alltogether, a 'binary' hint would be better, as the user should expect "pc_query -a" to show all existing tags.
so does owncloud display the image correctly?
I guess a
yes, ownclowd, the android address book and evolution all display the image correctly. so maybe something like this would be better:
try:
line = key + types + ': ' + value[0]
except UnicodeDecodeError:
line = key + types + ': <BINARY DATA>'
collector.append(line)
thanks for bringing this to my attention, it should be fixed in 07589c762582a75a977dae3cae3ce51f5c8e5c51 . I'll leave this issue open, since I still want to find out why this happens in the first place.
If you want to be named in the contributors file, please give me a name, email address, etc
when running "pc_query -a" on a contact with a jpeg PHOTO, python fails with:
Possible solution might be to prevent "PHOTO" property from being pretty-printed or using a try/catch block to automatically filter any non-printable properties.