[PyWPS-dev] json requests return utf-8 encoded strings :(

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PyWPS-dev] json requests return utf-8 encoded strings :(

Martin Paredes

Anytime I request data as json I receive back a html escaped (utf-8) string. It seems that because the data is already in 

    <![CDATA[

there should be no need to convert each " to &#34; as it's just making the data so much larger.

What can I do to set the json to be returned as a regular ascii string? Is there a configuration setting, or do I need to modify the pywps code and rebuld (if so, could you point me to what I need to modify please)?

I've tried changing the pywps.cfg​ like so:


[server]

encoding=iso-8859-1


This happens with the default example testjson example (I didn't change anything, it was run straight from the code downloaded from github). Instead of getting back:    ​


<wps:ComplexData mimeType="application/geojson" encoding="" schema=""><![CDATA[

                    ["foo", {"bar":["baz", null, 1.0, 2]}]

 ]]></wps:ComplexData>

I'm getting:


<wps:ComplexData mimeType="application/geojson" encoding="" schema=""><![CDATA[
                            [
  &#34;foo&#34;, 
  {
    &#34;bar&#34;: [
      &#34;baz&#34;, 
      null, 
      1.0, 
      2
    ]
  }
]
]]></wps:ComplexData>



Martin Paredes
DZYNE Technologies
Desk: 703.291.6662
Mobile: 202.251.7655


_______________________________________________
pywps-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/pywps-dev
Reply | Threaded
Open this post in threaded view
|

Re: json requests return utf-8 encoded strings :(

Carsten Ehbrecht-3
Hi Martin,

I usually return json files as reference, so I can avoid this. I haven’t checked how the correct way of returning data within the WPS response should be. You could open an issue for this on GitHub.


Cheers,
Carsten

On 29. Aug 2018, at 21:24, Martin Paredes <[hidden email]> wrote:

Anytime I request data as json I receive back a html escaped (utf-8) string. It seems that because the data is already in 
    <![CDATA[
there should be no need to convert each " to &#34; as it's just making the data so much larger.
What can I do to set the json to be returned as a regular ascii string? Is there a configuration setting, or do I need to modify the pywps code and rebuld (if so, could you point me to what I need to modify please)?
I've tried changing the pywps.cfg​ like so:

[server]
encoding=iso-8859-1

This happens with the default example testjson example (I didn't change anything, it was run straight from the code downloaded from github). Instead of getting back:    ​

<wps:ComplexData mimeType="application/geojson" encoding="" schema=""><![CDATA[
                    ["foo", {"bar":["baz", null, 1.0, 2]}]
 ]]></wps:ComplexData>

I'm getting:

<wps:ComplexData mimeType="application/geojson" encoding="" schema=""><![CDATA[
                            [
  &#34;foo&#34;, 
  {
    &#34;bar&#34;: [
      &#34;baz&#34;, 
      null, 
      1.0, 
      2
    ]
  }
]
]]></wps:ComplexData>



Martin Paredes
DZYNE Technologies
Desk: 703.291.6662
Mobile: 202.251.7655

_______________________________________________
pywps-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/pywps-dev


_______________________________________________
pywps-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/pywps-dev