Index: src/core-utils/gnc-glib-utils.c =================================================================== --- src/core-utils/gnc-glib-utils.c (revision 17061) +++ src/core-utils/gnc-glib-utils.c (working copy) @@ -229,6 +229,20 @@ return result; } +gchar * +gnc_locale_from_utf8(const gchar* str) +{ + gchar * locale_str; + gsize bytes_written = 0; + GError * err = NULL; + + locale_str = g_locale_from_utf8(str, -1, NULL, &bytes_written, &err); + if (err) + g_warning("g_locale_from_utf8 failed: %s", err->message); + + return locale_str; +} + GList* gnc_g_list_map(GList* list, GncGMapFunc fn, gpointer user_data) { Index: src/core-utils/gnc-glib-utils.h =================================================================== --- src/core-utils/gnc-glib-utils.h (revision 17061) +++ src/core-utils/gnc-glib-utils.h (working copy) @@ -80,6 +80,7 @@ * @return A newly allocated string that has to be g_free'd by the * caller. */ gchar *gnc_utf8_strip_invalid_strdup (const gchar* str); +gchar *gnc_locale_from_utf8(const gchar* str); typedef gpointer (*GncGMapFunc)(gpointer data, gpointer user_data); Index: src/core-utils/core-utils.scm =================================================================== --- src/core-utils/core-utils.scm (revision 17061) +++ src/core-utils/core-utils.scm (working copy) @@ -12,6 +12,7 @@ (re-export gnc-is-debugging) (re-export g-find-program-in-path) (re-export gnc-utf8-strip-invalid-strdup) +(re-export gnc-locale-from-utf8) (re-export gnc-scm-log-warn) (re-export gnc-scm-log-error) (re-export gnc-scm-log-msg) Index: src/core-utils/core-utils.i =================================================================== --- src/core-utils/core-utils.i (revision 17061) +++ src/core-utils/core-utils.i (working copy) @@ -21,3 +21,5 @@ %newobject gnc_utf8_strip_invalid_strdup; gchar * gnc_utf8_strip_invalid_strdup(const gchar *); +%newobject gnc_locale_from_utf8; +gchar * gnc_locale_from_utf8(const gchar *);