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

Piotr Caban piotr.caban at gmail.com
Wed Mar 20 08:28:20 CDT 2019


Hi,

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).

There are XIM bindings for XCB. Hopefully we will be able to use it in 
future. I'm not sure what is its status but it doesn't seem  to be 
widely available.

I see 2 possible solutions for that:
  - go with the ascii_{tolower,toupper,strcasecmp,strncasecmp} helpers 
and use them instead of glibc functions
  - try to detect locales that we don't support properly and set a 
different one in this case, I'm thinking about something like this:
if (strcasecmp("abc...z", "ABC...Z"))
     setlocale(LC_CTYPE, "en_US.UTF-8");
It will not work if en_US.UTF-8 locale is not available.

I prefer the first solution (it will work even if e.g. there's a library 
that changes locale). A simple grep shows that there are around 300 uses 
of tolower/toupper/strcasecmp/strncasecmp functions in wine (probably 
all will need to be changed).

Thanks,
Piotr

On 3/19/19 4:41 PM, Piotr Caban wrote:
> Hi Jactry,
> 
> On 3/19/19 6:06 AM, Jactry Zeng wrote:
>> On Mon, Mar 18, 2019 at 9:24 PM Alexandre Julliard 
>> <julliard at winehq.org <mailto:julliard at winehq.org>> wrote:
>>  >
>>  > Module: wine
>>  > Branch: master
>>  > Commit: c8e195e1797bd513c91927743b3ed38fdfa86c2f
>>  > URL: 
>> https://source.winehq.org/git/wine.git/?a=commit;h=c8e195e1797bd513c91927743b3ed38fdfa86c2f 
>>
>>  >
>>  > Author: Piotr Caban <piotr at codeweavers.com 
>> <mailto:piotr at codeweavers.com>>
>>  > Date:   Mon Mar 18 20:03:40 2019 +0100
>>  >
>>  > kernel32: Restore C locale for LC_CTYPE category.
>>
>> I found that this commit broke CJK input method on Wine, even with 
>> Sagawa's patch for bug 46851[1].
>> It seems that Fcitx needs a LC_CTYPE matched to local language. 
>> Reverting this commit and applying Sagawa's patch can fix the problem.
>> I don't know if we can fix the input medthod problem in imm32 or some 
>> other components instead of reverting this commit.
> I'll look into it (I can reproduce it).
> 
> Thanks,
> Piotr




More information about the wine-devel mailing list