trailing whitespace in strings

Behdad Esfahbod behdad at behdad.org
Tue Nov 21 14:21:13 PST 2006


On Tue, 2006-11-21 at 16:12 -0500, Bastian, Waldo wrote:
> KDE ignores trailing spaces. I'm ok to mandate that in the spec if
> someone can provide a patch for Gnome/Gtk to do the same. 

Just make sure there is a way to NOT ignore leading and trailing
whitespace.  Using double-quotes for example.

behdad

> Cheers,
> Waldo
>  
> Intel Corporation - Channel Platform Solutions Group - Hillsboro, Oregon
> 
> >-----Original Message-----
> >From: xdg-bounces at lists.freedesktop.org [mailto:xdg-
> >bounces at lists.freedesktop.org] On Behalf Of Ralph Giles
> >Sent: Tuesday, November 21, 2006 11:25 AM
> >To: xdg at lists.freedesktop.org
> >Subject: trailing whitespace in strings
> >
> >Apologies if this has been discussed; I couldn't find the actual
> >decision in the archives.
> >
> >The 0.9.8 desktop entry spec says that 'Space before and after the
> >equals sign should be ignored' but says nothing about trailing
> >whitespace. glib, it seems, interprets this as 'trailing whitespace
> >is part of a string value'.
> >
> >However, this violates general practice of human-editable config files,
> >where whitespace is minimally relevent. In particular, see
> >
> >  https://maemo.org/bugzilla/show_bug.cgi?id=859
> >
> >where at least two of us have lost developer time because our editors
> >didn't indicate trailing whitespace in a .desktop string value, and it
> >took a while to discover the parser thought it was meaningful.
> >
> >I would further argue that having meaningful trailing whitespace isn't
> >especially useful. The spec defines a string type as containing 'all
> >ASCII characters except for control characters' so this type can't be
> >used for binary blobs. If trailing spaces in an ASCII value are
> required
> >for by an application they can still be included using the '\s' escape
> >sequence.
> >
> >Therefore I would suggest changing the spec to indicate that leading
> >and trailing whitespace be stripped from values, just as trailing
> >whitespace (well 'space', I guess tab is a control character?) is
> >current stripped from keys and leading whitespace is stripped from
> >values. In the common case this will be more efficient in developer
> >time and removes no functionality from the design.
> >
> >(On a related note, the 0.9.8 spec also says 'desktop entry files are
> >encoded as lines of 8 bit characters', which conflicts with both the
> >definition of the string and localestring types assuming the usual
> >unicode definition of 'charater'. Perhaps it should say '8 bit bytes'
> >or '8 bit chars'?)
> >
> > -r
> >_______________________________________________
> >xdg mailing list
> >xdg at lists.freedesktop.org
> >http://lists.freedesktop.org/mailman/listinfo/xdg
> _______________________________________________
> xdg mailing list
> xdg at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xdg
-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759





More information about the xdg mailing list