Piotr Caban : kernel32: Restore C locale for LC_CTYPE category.

Piotr Caban piotr.caban at gmail.com
Wed Mar 20 11:16:25 CDT 2019


On 3/20/19 4:25 PM, Ken Thomases wrote:
> On Mar 20, 2019, at 10:02 AM, Chip Davis <cdavis at codeweavers.com> wrote:
>>
>> March 20, 2019 9:58 AM, "Ken Thomases" <ken at codeweavers.com> wrote:
>>
>>> On Mar 20, 2019, at 8:28 AM, Piotr Caban <piotr.caban at gmail.com> wrote:
>>>
>>>> I've looked for the solution of this problem and I failed to find one that works with C locale. It
>>>> looks like XIM is not working when it's initialized in C or POSIX locale even if wchar_t or utf8
>>>> variant of lookup functions is used (XwcLookupString, Xutf8LookupString).
>>>
>>> […]
>>>> I see 2 possible solutions for that:
>>>> - go with the ascii_{tolower,toupper,strcasecmp,strncasecmp} helpers and use them instead of glibc
>>>> functions
>>>
>>> What about the xlocale functions (e.g. tolower_l())? If you pass a NULL locale_t to them, they
>>> operate in the C locale.
>>
>> Only the POSIX ones do that. The Microsoft ones use the global locale. Also, I suspect those functions aren't available everywhere--even though POSIX 2008 has been a thing for over a decade.
> 
> But aren't we only interested in changing the behavior of the POSIX ones?
Then we will need to provide tolower_l implementation for systems that 
don't support it (unless you want to use it inside of the ascii_tolower 
function, we will also need to include config.h in many files).

> An alternative approach might be to leave LC_CTYPE set to the C locale but wrap the XIM functions in uselocale() calls to set the locale to the one that Wine had been using before this change and then set it back.  I don't know if that will be enough to get things to work.
XIM is ignoring locale set with uselocale function. You will need to 
call setlocale to make it work but it changes the locale for whole process.

For the reference, the functions that needs to be called in non C locale 
are:
XOpenIM
XSupportsLocale
XSetLocaleModifiers

Thanks,
Piotr



More information about the wine-devel mailing list