Re: [dev] [dwm] NULL byte in WM_NAME

From: Quentin Rameau <>
Date: Wed, 27 Dec 2017 10:44:07 +0100


> The current behaviour (NUL termination) seems fine to me.

I think it is too, although it raises some kind of ambiguity in the X
data property handling.
Maybe the well-written Xlib documentation can shed a light for us here

> Can you explain why the current behaviour is wrong? Please point to
> the proper X11 documentation.

In the WM_NAME doc [0], we can read that the encoding on the data is
implied by the type of the property.

In the TEXT property doc [1], we can read that STRING type data should
be separated by null characters, does it mean the ending null character
should be present too?

On one hand, I'd like to keep the data as it is, it's a C string, so
terminate it with a null char.

> > in this code [2] because the returned string contains a '\0' and the
> > documentation for g_utf8_validate() [3] explicitly states that when
> > string length is provided, no nul bytes are allowed.

But then we advertise the data type as an UTF8_STRING, so validating
tools may be allowed to take raw data and pass it to a check function.

Should be use a C_STRING and keep the null char? Or keep the type and
remove it?
I'd be for keeping a C_STRING.

Received on Wed Dec 27 2017 - 10:44:07 CET

This archive was generated by hypermail 2.3.0 : Wed Dec 27 2017 - 10:48:21 CET