Bug 10870 - libX11 doesn't understand C.UTF-8 locale
Summary: libX11 doesn't understand C.UTF-8 locale
Status: RESOLVED FIXED
Alias: None
Product: cygwin
Classification: Unclassified
Component: Cygwin/X (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Yaakov Selkowitz
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-29 18:21 UTC by Jon Turney
Modified: 2009-11-12 18:24 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
Patch for appying to /usr/share/X11/locale to add C.UTF-8 to locales libX11 knows about (377 bytes, patch)
2009-10-29 18:25 UTC, Jon Turney
Details | Diff
Corresponding source patch (580 bytes, patch)
2009-10-29 18:26 UTC, Jon Turney
Details | Diff
XServer patch to make XSupportsLocale failure non-critical (769 bytes, patch)
2009-10-29 19:00 UTC, Jon Turney
Details | Diff
Don't crash if conversion of window name to UTF-8 fails (685 bytes, patch)
2009-11-10 02:10 UTC, Jon Turney
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jon Turney 2009-10-29 18:21:46 UTC
http://cygwin.com/ml/cygwin-xfree/2009-10/msg00106.html

libX11 doesn't understand about the C.UTF-8 locale, so XSupportsLocale() fails
in that locale.

Ordinarily this wouldn't be a problem, although applications will typically
complain that "Warning: locale not supported by C library, locale unchanged"

Unfortunately the server considers it a fatal error if XSupportsLocale() fails
for internal clients.  This is probably wrong.
Comment 1 Jon Turney 2009-10-29 18:25:42 UTC
Created attachment 4340 [details]
Patch for appying to /usr/share/X11/locale to add C.UTF-8 to locales libX11 knows about
Comment 2 Jon Turney 2009-10-29 18:26:16 UTC
Created attachment 4341 [details]
Corresponding source patch
Comment 3 Jon Turney 2009-10-29 19:00:24 UTC
Created attachment 4342 [details]
XServer patch to make XSupportsLocale failure non-critical
Comment 4 Yaakov Selkowitz 2009-11-03 19:37:51 UTC
(In reply to comment #3)
> Created an attachment (id=4342)
> XServer patch to make XSupportsLocale failure non-critical

With cygwin 1.7.0-63 out, I think we need to push this quickly.

Patch added to the queue for 1.7.1-2.
Comment 5 Yaakov Selkowitz 2009-11-03 19:42:58 UTC
(In reply to comment #2)
> Created an attachment (id=4341)
> Corresponding source patch

Thanks for the patch.  What I don't understand is, if this C.UTF-8 locale is
Debian's idea, why doesn't there libX11 have a similar patch[1]?

[1] http://patch-tracker.debian.org/package/libx11/2:1.3-1
Comment 6 Jon Turney 2009-11-03 19:48:01 UTC
(In reply to comment #5)
> (In reply to comment #2)
> > Created an attachment (id=4341)
> > Corresponding source patch
> 
> Thanks for the patch.  What I don't understand is, if this C.UTF-8 locale is
> Debian's idea, why doesn't there libX11 have a similar patch[1]?
> 
> [1] http://patch-tracker.debian.org/package/libx11/2:1.3-1

I don't know. Possibly because no-one actually runs their system in C.UTF-8.  It
looks like the idea is that C.UTF-8 is only intended for use in things like
build environments which require a language-neutral but UTF-8 aware locale.

Comment 7 Yaakov Selkowitz 2009-11-09 19:14:48 UTC
Server patch shipped in 1.7.1-2.  I saw there was some further discussion about
the xlib part of this patch; what was your conclusion?
Comment 8 Jon Turney 2009-11-09 22:36:51 UTC
(In reply to comment #7)
> Server patch shipped in 1.7.1-2.  I saw there was some further discussion about
> the xlib part of this patch; what was your conclusion?

I think the xlib changes are ok to publish.  But there still some other odd
behaviour being reported which I guess is due to no longer building with X_LOCALE.
Comment 9 Jon Turney 2009-11-10 02:10:08 UTC
Created attachment 4376 [details]
Don't crash if conversion of window name to UTF-8 fails

This fixes the crash, but windows just end up with blank titles.

There's a deeper problem that Xlib doesn't seem to know how to convert strings
to C.UTF-8 locale encoding (although this should be pretty trivial) :-)
Comment 10 Jon Turney 2009-11-10 14:06:14 UTC
(In reply to comment #9)
> Created an attachment (id=4376)
> Don't crash if conversion of window name to UTF-8 fails
> 
> This fixes the crash, but windows just end up with blank titles.
> 
> There's a deeper problem that Xlib doesn't seem to know how to convert strings
> to C.UTF-8 locale encoding (although this should be pretty trivial) :-)

Doh! I'd reverted the Xlib locale data patch. With that present, the window
titles get converted correctly.

So that seems pretty clear that both parts are actually needed :-)

Perhaps the Xserver could be a bit smarter about fallbacks when trying to
convert window titles and clipboard strings to the locale encoding, but I'm not
sure how...
Comment 11 Yaakov Selkowitz 2009-11-12 01:20:28 UTC
(In reply to comment #9)
> Created an attachment (id=4376)
> Don't crash if conversion of window name to UTF-8 fails

Patch added to queue for 1.7.1-3.

FYI, this didn't apply cleanly to 1.7.1 due to whitespace alignment differences,
so the patch in SVN is slightly different to compensate.
Comment 12 Yaakov Selkowitz 2009-11-12 18:24:43 UTC
Second patch for xserver shipped in 1.7.1-3.
Patch for xlib shipped in 1.3.2-2.
Closing.