[Interest] QSettings keys

René Hansen renehh at gmail.com
Wed Aug 22 22:32:10 CEST 2018


Check out the whitespace section of https://en.wikipedia.org/wiki/INI_file.
Inconsistent whitespace handling is the reason you really want to encode it.

/René

On Wed, 22 Aug 2018 at 20:06 Bertwim <bwvb at xs4all.nl> wrote:

> This is what I observe:
>
> For instance, if I enter the following, manually, in the ini file:
>
> [  foo:bar  ]
> line 1 = some text
>     line:tail = indented + key has character ':'
>
> and then look at the ini-file after it has been rewritten to disk, this
> has become:
>
> [foo%3Abar]
> line%201=some text
> line%3Atail=indented + key has character ':'
>
> Now, looking at the keys, removing the leading and trailing white spaces
> makes sense to me, as does removing the white spaces around the '='.
> However, writing the space between 'line' and '1' with the %20 encoding,
> and likewise the %3A for the colon looks weird
> and unnecessary, as they are normal ascii characters.
>
> Regards
> Bertwim
>
>
> On 08/22/2018 06:57 PM, Thiago Macieira wrote:
> > On Wednesday, 22 August 2018 01:42:20 PDT Bertwim wrote:
> >> Hi,
> >>
> >> I have a problem with understanding QSettings.  I see that when the
> >> settings are written back to file (ini-file, Linux) certain characters
> >> such as <space>, ':' (colon), etc, written in their hexadecimal encoding
> >> (%20 for space, %3A for ':').
> >> When keys are read (from an ini file) these characters are read as
> >> expected, but writing them back gives this encoding.
> >> Why is this, and -more importantly- Is there any way to prevent this, at
> >> least have the normal printable ascii characters written back to file
> > Are you reporting that you don't get the same string back when you read
> from
> > the file? That would be a bug and we'd need to fix it
> >
> > The escaping is used because those characters are special in the file
> format.
> > For example, the following two lines declare the same key and value:
> >
> > foo=bar
> >   foo = bar
> >
> > So, no, you cannot turn escaping off. You really want it.
> >
> >
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180822/890d9916/attachment.html>


More information about the Interest mailing list