# HG changeset patch # User zas_ # Date 1210634760 0 # Node ID 91dfc98f3ca17fc3fa66481a3f0e71b9532610c5 # Parent b50deb0f9968528119f5858fabe19312dc4c720a Reading of Iptc.Application2.Keywords should now be fixed. Use uft8_validate_or_convert() on exif's text data to be safe. diff -r b50deb0f9968 -r 91dfc98f3ca1 src/bar_info.c --- a/src/bar_info.c Mon May 12 23:21:35 2008 +0000 +++ b/src/bar_info.c Mon May 12 23:26:00 2008 +0000 @@ -283,7 +283,9 @@ if (comment) { ExifItem *item = exif_get_item(exif, COMMENT_KEY); + *comment = exif_item_get_string(item, 0); + *comment = utf8_validate_or_convert(*comment); } if (keywords) @@ -297,25 +299,35 @@ { gchar *kw = exif_item_get_string(item, i); + kw = utf8_validate_or_convert(kw); if (!kw) break; *keywords = g_list_append(*keywords, (gpointer) kw); } -#if 0 + /* FIXME: * Exiv2 handles Iptc keywords as multiple entries with the * same key, thus exif_get_item returns only the first keyword * and the only way to get all keywords is to iterate through * the item list. */ - item = exif_get_item(exif, "Iptc.Application2.Keywords"); - for (i = 0; i < exif_item_get_elements(item); i++) + for (item = exif_get_first_item(exif); + item; + item = exif_get_next_item(exif)) { - gchar *kw = exif_item_get_string(item, i); + guint tag; + + tag = exif_item_get_tag_id(item); + if (tag == 0x0019) /* Iptc.Application2.Keywords */ + { + gchar *kw; - if (!kw) break; - *keywords = g_list_append(*keywords, (gpointer) kw); + kw = exif_item_get_data_as_text(item); + kw = utf8_validate_or_convert(kw); + + if (!kw) continue; + *keywords = g_list_append(*keywords, (gpointer) kw); + } } -#endif } exif_free(exif);