diff src/exiv2.cc @ 1053:77ca9a5d42be

fixed charset of exiv2 strings in non-utf8 locales
author nadvornik
date Sat, 04 Oct 2008 20:28:31 +0000
parents 338c21c87ff5
children 1646720364cf
line wrap: on
line diff
--- a/src/exiv2.cc	Wed Oct 01 20:57:56 2008 +0000
+++ b/src/exiv2.cc	Sat Oct 04 20:28:31 2008 +0000
@@ -375,7 +375,7 @@
 {
 	try {
 		if (!item) return NULL;
-		return g_strdup(((Exiv2::Metadatum *)item)->tagLabel().c_str());
+		return g_locale_to_utf8(((Exiv2::Metadatum *)item)->tagLabel().c_str(), -1, NULL, NULL, NULL);
 	}
 	catch (std::exception& e) {
 //		std::cout << "Caught Exiv2 exception '" << e << "'\n";
@@ -449,7 +449,7 @@
 		if (!item) return NULL;
 		Exiv2::Metadatum *metadatum = (Exiv2::Metadatum *)item;
 #if EXIV2_TEST_VERSION(0,17,0)
-		return g_strdup(metadatum->print().c_str());
+		return g_locale_to_utf8(metadatum->print().c_str(), -1, NULL, NULL, NULL);
 #else
 		std::stringstream str;
 		Exiv2::Exifdatum *exifdatum;
@@ -466,7 +466,7 @@
 			str << *xmpdatum;
 #endif
 
-		return g_strdup(str.str().c_str());
+		return g_locale_to_utf8(str.str().c_str(), -1, NULL, NULL, NULL);
 #endif
 	}
 	catch (Exiv2::AnyError& e) {
@@ -491,6 +491,7 @@
 			if (pos != std::string::npos) str = str.substr(pos+1);
 			}
 
+//		return g_locale_to_utf8(str.c_str(), -1, NULL, NULL, NULL); // FIXME
 		return g_strdup(str.c_str());
 	}
 	catch (Exiv2::AnyError& e) {
@@ -530,11 +531,11 @@
 	}
 }
 
-const gchar *exif_get_tag_description_by_key(const gchar *key)
+gchar *exif_get_tag_description_by_key(const gchar *key)
 {
 	try {
 		Exiv2::ExifKey ekey(key);
-		return Exiv2::ExifTags::tagLabel(ekey.tag(), ekey.ifdId ());
+		return g_locale_to_utf8(Exiv2::ExifTags::tagLabel(ekey.tag(), ekey.ifdId ()), -1, NULL, NULL, NULL);
 	}
 	catch (Exiv2::AnyError& e) {
 		std::cout << "Caught Exiv2 exception '" << e << "'\n";