Re: [gexiv2] Python 2/3 and unicode
- From: Jim Nelson <jim yorba org>
- To: Jim Easterbrook <jim jim-easterbrook me uk>
- Cc: gexiv2-list gnome org
- Subject: Re: [gexiv2] Python 2/3 and unicode
- Date: Fri, 08 Aug 2014 12:56:25 -0700
There are two tickets that are related to this question:
However, I'm still unsure what encoding this string is in (if it is encoded and not just garbage).
But this is about detecting the character encoding for IPTC, not EXIF. (As you mentioned, EXIF only supports ASCII.)
Unfortunately, I'm not a Python hacker and can't provide help any further that direction. If there's a way to disable (or provide a different codec) in Python, you should take that up with a Python forum.
-- Jim
On Fri, Aug 8, 2014 at 2:45 AM, Jim Easterbrook <jim jim-easterbrook me uk> wrote:
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/>
_______________________________________________
gexiv2-list mailing list
gexiv2-list gnome org
https://mail.gnome.org/mailman/listinfo/gexiv2-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]