开发者

X11 XM_NAME type is 'UTF-8' rather than STRING_UTF8

开发者 https://www.devze.com 2023-04-02 01:29 出处:网络
I\'m looking at some X11 code that uses XmbTextListToTextProperty to set the WM_NAME property, with encoding style XTextStyl开发者_如何转开发e.

I'm looking at some X11 code that uses XmbTextListToTextProperty to set the WM_NAME property, with encoding style XTextStyl开发者_如何转开发e.

http://tronche.com/gui/x/xlib/ICC/client-to-window-manager/XmbTextListToTextProperty.html suggests XTextStyle means the type/encoding of the property will depend on the current locale.

I'm not sure how to interpret http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.2.1 , it seems it allows the type of WM_NAME to be dependent of the current locale.

My current locale is 'en_US.UTF-8'. Everything I've seen so far suggests that the type of WM_NAME should be of type STRING, COMPOUND_STRING or UTF8_STRING.

However, xprop reports UTF-8, and xwininfo reports 'name in unsupported encoding UTF-8'. Checking the code, indeed it has support for UTF8_STRING but not UTF-8.

I'm at a loss as to where this UTF-8 comes from. Any ideas?


It looks like besides the standard types STRING, COMPOUND_STRING and UTF8_STRING (the latter is an XFree86 extension), it is also acceptable to have any multibyte encoding.

When passing XTextStyle to XmbTextListToTextProperty will simply take the current encoding from the current locale. In the en_US.UTF-8 locale, that would be UTF-8. To get the standardized (by XFree86) UTF8_STRING type for the property, we need to pass XUTF8StringStyle to XmbTextListToTextProperty instead of XTextStyle

0

精彩评论

暂无评论...
验证码 换一张
取 消