Skip to content

(Issue #3007) Fix metadata encoding issue in Windows

Nikc requested to merge (removed):gimp-2-10 into gimp-2-10

This commit addresses issue #3007. Currently, metadata is retrieved as a char* from gexiv2_metadata_get_tag_interpreted_string(). The output is then further processed via g_locale_to_utf8().

Since g_locale_to_utf8() relies on the system locale being set properly, the function incorrectly "converts" and garbles non-ASCII values if it is not (commented on here: https://mail.gnome.org/archives/gtk-list/2003-August/msg00253.html). This affects many Windows users as well as anyone with faulty system locale settings.

This commit adds a conditional check with g_utf8_validate() to determine if the value from gexiv2_metadata_get_tag_interpreted_string() is already encoded correctly. If it is, it's used directly; if not, it then runs g_locale_to_utf8() to convert to UTF-8. This patch works in Windows, and shouldn't affect any other platform.

Merge request reports