Bug#175370: patch: use UTF-8 internally, convert to locale's encoding for output
On Sat, Jan 04, 2003 at 07:43:33PM -0500, Colin Walters wrote:
[...]
> +void locale_printf_init()
> +{
> + char *lang = getenv ("LANG");
> + char *dot;
> +
> + if (locale_encoding)
> + return;
> +
> + if (!lang)
> + goto out_ascii;
> + dot = strchr (lang, '.');
> + if (dot && dot+1)
> + locale_encoding = strdup(dot+1);
> + if (!locale_encoding)
> + goto out_ascii;
> + return;
> + out_ascii:
> + locale_encoding = strdup("US-ASCII");
> + if (!strcmp (locale_encoding, "UTF-8"))
> + locale_is_utf8 = 1;
> +}
Unfortunately situation is much more complex (you must check LC_ALL and
LC_CTYPE variables too), the simplest solution is to run 'locale charmap'
to retrieve the current encoding.
Did you test your patch on a system where no UTF-8 locales are generated?
I am not sure it works then.
Denis
Reply to: