diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2009-02-25 09:21:41 +0100 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2009-02-25 09:21:41 +0100 |
commit | 943641e68b1b0d50262c8008fe6a3e61151f48a2 (patch) | |
tree | 45f9936dd3a4058541d600294dbb84be13e1d2db /src/pyexiv2.py | |
parent | 9564f01d928d2a654a4dd3933025e20266adddab (diff) | |
download | pyexiv2-943641e68b1b0d50262c8008fe6a3e61151f48a2.tar.gz |
IPTC String to string conversion.
Diffstat (limited to 'src/pyexiv2.py')
-rw-r--r-- | src/pyexiv2.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/pyexiv2.py b/src/pyexiv2.py index 2c49db9..2cda133 100644 --- a/src/pyexiv2.py +++ b/src/pyexiv2.py @@ -543,6 +543,17 @@ class IptcTag(MetadataTag): else: raise IptcValueError(value, xtype) + elif xtype == 'String': + if type(value) is unicode: + try: + return value.encode('utf-8') + except UnicodeEncodeError: + raise IptcValueError(value, xtype) + elif type(value) is str: + return value + else: + raise IptcValueError(value, xtype) + # TODO: other types raise IptcValueError(value, xtype) |