Re: Suggested patch for improved locale handling on Win32
- From: Tor Lillqvist <tml iki fi>
- To: Owen Taylor <otaylor redhat com>
- Cc: gtk-devel-list gnome org
- Subject: Re: Suggested patch for improved locale handling on Win32
- Date: Sat, 20 Sep 2003 22:23:18 +0000
> On Thu, 2003-09-18 at 20:27, Tor Lillqvist wrote:
> > g_win32_getlocale() currently looks for LC_MESSAGES (After LC_ALL and
> > before LANG). it probably should be changed to look for LC_CTYPE
> > instead.
Owen Taylor writes:
> I guess it depends on what it is used for. To change it from returning
> the message locale to returning the CTYPE locale seems a bit dubious
> to me in terms of compatibility.
Well, considering that g_win32_getlocale looks at LC_ALL, LC_MESSAGES
and LANG hasn't been documented anyway (my bad), and that looking at
the Unixish LC_* env vars is not something that many users would know
to expect anyway, I don't think that is much of a problem.
> I think there are memory leak problems with your patch. Your new
> function returns memory that must be freed, which is different
> from setlocale(LC_CTYPE, NULL), so you can't just make a single
> line substitution.
> > - locale = setlocale (LC_CTYPE, NULL);
> > + locale = _gtk_get_lc_ctype ();
True, but on the other hand that code path is executed at the most
once, isn't it? But OK, I can g_free() it.
> The language here needs some help. Can I suggest: [...]
> The typical language for this is 'should not be modified or freed'
] [Thread Prev