[Bug 51407] New: kernel32:time's test_GetCalendarInfo() fails in Hindi

WineHQ Bugzilla wine-bugs at winehq.org
Mon Jul 5 18:08:42 CDT 2021


https://bugs.winehq.org/show_bug.cgi?id=51407

            Bug ID: 51407
           Summary: kernel32:time's test_GetCalendarInfo() fails in Hindi
           Product: Wine
           Version: 6.10
          Hardware: x86-64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: kernel32
          Assignee: wine-bugs at winehq.org
          Reporter: fgouget at codeweavers.com
      Distribution: ---

Created attachment 70263
  --> https://bugs.winehq.org/attachment.cgi?id=70263
Broken fix and traces

Three GetCalendarInfo() checks fail in Hindi:

https://test.winehq.org/data/patterns.html#kernel32:time

time.c:728: Test failed: GetCalendarInfoA failed err 87
time.c:731: Test failed: GetCalendarInfoA failed err 87
time.c:738: Test failed: got 0, expected 7

The immediate cause for the failure is that Hindi is one of the few languages
for which  NLS_IsUnicodeOnlyLcid() returns true. In turn this causes the ANSI
GetCalendarInfoA() to return ERROR_INVALID_PARAMETER. The last failure just
reflects the fact that the two calls to GetCalendarInfoA() should not have
failed.


Only Hindi fails and only in Wine. But before declaring this a Wine bug we need
to look at Windows.

* For some reason probably related to SetWinLocale [1] the system locale of
w10pro64_hi is still English.

* This causes both the ANSI and Unicode GetCalendarInfo() to return English
names (Monday).

* Manually setting the system locale to Hindi is possible on Windows 10 2004.
What's interesting is the disabled and checked-by-default checkbox in that
dialog:
  [X] Beta: Use Unicode UTF-8 for worldwide language support

* And indeed doing that and running the test again results in
GetCalendarInfoA() returning UTF-8 strings on Windows!

time.c:730: ret=19
sdayname1="\xe0\xa4\xb8\xe0\xa5\x8b\xe0\xa4\xae\xe0\xa4\xb5\xe0\xa4\xbe\xe0\xa4\xb0"
सोमवार
time.c:735: ret2=19
sdayname1="\xe0\xa4\xb8\xe0\xa5\x8b\xe0\xa4\xae\xe0\xa4\xb5\xe0\xa4\xbe\xe0\xa4\xb0"
सोमवार
time.c:742: ret2=19 sdayname1=L"\0938\094b\092e\0935\093e\0930"

* The beta moniker strongly suggests that this is a new option. Indeed
selecting Hindi as the system locale was not possible in Windows 8.1 for
instance.

* This is probably also why SetWinLocale has trouble setting the system locale
to Hindi.

So the Windows behavior can be summarized as such:
* Return localized values for non-Unicode-only locales.
* In older Windows versions setting the system locale to a Unicode-only locale
is impossible.
* In newer Windows versions setting the system locale to a Unicode-only locale
is possible and then it uses UTF-8.


Commenting out the Hindi line in NLS_IsUnicodeOnlyLcid() fixes the failures in
Wine (see attached patch). But this fix is wrong because it causes
GetCalendarInfoA() to return question marks instead of intelligible strings.
(it also impacts many APIs but that's probably ok based on the Windows
behavior)


So Wine should do one of the following:

1. Stick to a 'safe' system locale when $LANG is set to a Unicode-only locale.
   Typically this would be English.

2. Or use UTF-8 when the system locale is a Unicode-only locale.

Option 2 would actually make a lot of sense on Unix systems but it is also more
likely to break Windows applications. So option 1 may be the safer (and
simpler?) option (for now).


[1]
https://source.winehq.org/git/tools.git/blob/HEAD:/testbot/bin/SetWinLocale#l746

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.


More information about the wine-bugs mailing list