[QGIS-Developer] JSON strings in global variables

Nyall Dawson nyall.dawson at gmail.com
Mon Apr 9 17:10:03 PDT 2018


On 10 April 2018 at 04:47, Adam Borczyk <adam.borczyk at gis-support.pl> wrote:
> Hello everyone,
>
> I'm developing a plugin under QGIS 2 environment in which I use global
> variables. I'd like to know if it's allowed to pass a JSON string into a
> global variable?
>
> My globals were fine until (I guess) I started to pass in jsons and now I
> face an issue I described here:
> https://gis.stackexchange.com/questions/277623/global-variables-in-qgis-mixed-on-some-computers
> - basically the assignment of values to variables is sometimes wrong, some
> even stay empty sometimes and it feels to be totally random.
>
> If anyone knows if jsons could introduce any error in globals, I would be
> grateful and it would narrow down my search. I don't know how are they
> parsed, so maybe OS regional settings (commas and colons thing) also come
> into play? Regards QGIS 2.18 and it's subversions (5, 9, 13, 18 etc.).

Possibly - the guts of this are buried deep within the Qt library, but
I'd be surprised to find if it's not correctly escaping the strings.
I'd suggest manually escaping/unescaping them and see if that helps.

You'll probably need to remove any existing variable settings keys to
test properly.

Nyall



>
> Best regards
>
> Adam Borczyk
>
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the QGIS-Developer mailing list