[gexiv2] Python 2/3 and unicode



I'm using the Python Gexiv2 bindings to read metadata from some .jpg files. Some of the files have EXIF data in the Latin-1 character set (yes, I know the EXIF spec says ASCII only).

In Python 2 I can cope with these files as 'get_tag_string' returns a Python 2 string, which I can then convert to unicode with the latin-1 codec. In Python 3 'get_tag_string' returns a unicode string (as all Python 3 strings are unicode) after converting with the utf-8 codec. This raises the UnicodeDecodeError exception when it encounters some latin-1 characters.

Is there any way to change the codec used by 'get_tag_string' or to change its return type from unicode to bytes?
--
Jim Easterbrook                 <http://www.jim-easterbrook.me.uk/>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]