aboutsummaryrefslogtreecommitdiffstats
path: root/src/pyexiv2.py
diff options
context:
space:
mode:
authorOlivier Tilloy <olivier@tilloy.net>2009-02-25 09:21:41 +0100
committerOlivier Tilloy <olivier@tilloy.net>2009-02-25 09:21:41 +0100
commit943641e68b1b0d50262c8008fe6a3e61151f48a2 (patch)
tree45f9936dd3a4058541d600294dbb84be13e1d2db /src/pyexiv2.py
parent9564f01d928d2a654a4dd3933025e20266adddab (diff)
downloadpyexiv2-943641e68b1b0d50262c8008fe6a3e61151f48a2.tar.gz
IPTC String to string conversion.
Diffstat (limited to 'src/pyexiv2.py')
-rw-r--r--src/pyexiv2.py11
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)