If conversion of script name to current locale fails try using
original string (which should be UTF-8) and hope that shell
will understand it.
Note that conversions to system locale succeed on Fedora and RHEL
(which set G_BROKEN_FILENAMES=1) and fail on Open SUSE and Ubuntu
which expect everything to be pure UTF-8. Also Ubuntu is quite
funky because when I switched system language to Russian LANG in
terminals still was set as en_US.UTF-8; /etc/default/locale has
to be edited manually.
Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
argv[0] = g_locale_from_utf8(script, -1, NULL, NULL, &err);
if (err != NULL) {
- g_error("Conversion error: %s\n", err->message);
+ g_debug("Conversion error: %s\n", err->message);
+ /*
+ * If we could not convert to current locate let's hope that
+ * what we have is a useable script name and use it directly.
+ */
+ argv[0] = g_strdup(script);
}
argv[1] = NULL;