RFC: escape strings in KConfigBase

Olivier Goffart ogoffart at kde.org
Tue May 15 07:17:27 BST 2007

Le mardi 15 mai 2007, Andreas Hartmetz a écrit :
> Hello list,
> I noticed that KConfigBase has some "forbidden" chars in certain fields,
> quote:
> "the '=' char is not allowed in keys and the ']' char is not allowed in a
> group name."
> ...and another char, ',' by default, is also forbidden if you want to use
> the (very convenient) list read/write functions.
> This is not state of the art, dangerous (who knows which strings happen to
> turn up in your config file), and cumbersome.

I also already had the problem (in my case this was with ',' in lists)

> I can come up with three possible solutions:
> - Auto-escape all strings, using the backslash notation if nothing better
> (i.e. faster to parse and still human readable) exists.
> - Provide an escape function that takes the chars to escape as a parameter
> - Add Escape/NoEscape as flags to the write/read functions.

I vote for automatic escape using backslash notation.

I don't see any case where you wouldn't want to escape.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070515/da75cd1d/attachment.sig>

More information about the kde-core-devel mailing list