+ free (default_encoding);
+ default_encoding = strdup (enc);
+}
+
+
+/* Attempts to set the encoding from a locale name
+ returns true if successfull.
+ This function does not (should not!) alter the current locale.
+*/
+bool
+set_encoding_from_locale (const char *loc)
+{
+ bool ok = true;
+ char *c_encoding;
+ char *loc_encoding;
+ char *tmp = strdup (setlocale (LC_CTYPE, NULL));
+
+ setlocale (LC_CTYPE, "C");
+ c_encoding = strdup (locale_charset ());
+
+ setlocale (LC_CTYPE, loc);
+ loc_encoding = strdup (locale_charset ());
+
+
+ if ( 0 == strcmp (loc_encoding, c_encoding))
+ {
+ ok = false;
+ }