guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] fix locale string reading


From: Peter Brett
Subject: Re: [PATCH] fix locale string reading
Date: Tue, 08 Nov 2011 13:31:57 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Nala Ginrut <address@hidden> writes:

> Here is the patch. It solved the problem like these:
> @@ -1532,6 +1533,7 @@ scm_from_locale_string (const char *str)
>  SCM
>  scm_from_locale_stringn (const char *str, size_t len)
>  {
> +  setlocale (LC_ALL, "");
>    return scm_from_stringn (str, len, locale_charset (),
>                             scm_i_get_conversion_strategy (SCM_BOOL_F));
>  }
> @@ -1758,6 +1760,7 @@ scm_to_locale_string (SCM str)
>  char *
>  scm_to_locale_stringn (SCM str, size_t *lenp)
>  {
> +  setlocale (LC_ALL, "");
>    return scm_to_stringn (str, lenp, 
>                           locale_charset (),
>                           scm_i_get_conversion_strategy (SCM_BOOL_F));

This patch *breaks* scm_to_locale_string() and
scm_from_locale_string().  The documentation for these functions quite
clearly states that they use "the current locale", not "the locale
specified by the environment variables". Not to mention the fact that
they change the current locale without restoring it afterwards.

So no, please don't do this.  It's obviously the Wrong Thing.

                            Peter

-- 
Peter Brett <address@hidden>
Remote Sensing Research Group
Surrey Space Centre




reply via email to

[Prev in Thread] Current Thread [Next in Thread]