[PATCH] Fix potentially broken white space truncation on certain Windows versions

Linus Torvalds torvalds at linux-foundation.org
Thu Mar 7 11:06:14 PST 2013


On Thu, Mar 7, 2013 at 10:44 AM, Lubomir I. Ivanov <neolit123 at gmail.com> wrote:
>
> In Subsurface, usages of string trimming are present in multiple
> locations, so to make this work try to use GLib's g_unichar_isspace(),
> given most of the application text is UTF-8. g_ascii_isspace() also
> works, as it is a locale agnostic version of isspace().

Hmm. I think g_unichar_isspace() is the wrong thing to do. It's not a
unicode character, it's a byte. So it gives the wrong value for bytes
that are possibly part of bigger unicode characters (if there is any
space in the 128-255 area, I didn't check).

g_ascii_isspace() is the right function to use. Or we could just do
our own and trim all bytes 0 <= x <=32 and be done with it that way
(but g_ascii_isspace() is likely better)

                Linus


More information about the subsurface mailing list