pellegrinimarcos / plsql-utils

Automatically exported from code.google.com/p/plsql-utils
0 stars 0 forks source link

REF Cursor to JSON, special characters encoding issue #9

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Have you had any luck getting this to work on queries that return text columns 
with embedded special chars? 

For example:

select 'Johnson & Johnson' as
company_name from dual;

generates an LPX-00242 parsing error.

Other than wrapping every column in the query with an encode stmt before 
submitting for conversion to JSON is there a way to handle this in the package?

Original issue reported on code.google.com by thehunge...@gmail.com on 11 Jan 2012 at 7:59

GoogleCodeExporter commented 8 years ago
as cdata format can parsing to json?

Original comment by motac...@gmail.com on 10 Jul 2013 at 9:24

GoogleCodeExporter commented 8 years ago
Hi,

I am also facing the same, If anyone of you get the solution please also, let 
me know?

Original comment by ashishgu...@gmail.com on 1 Dec 2014 at 3:51

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I found a nice simple fix that worked for me!
In the package body, there is a function `get_xml_to_json_stylesheet`.
In the top of the function you should change the output declaration method from 
"text" to "xml".

FROM
<xsl:output indent="no" omit-xml-declaration="yes" method="text" 
encoding="UTF-8" media-type="text/x-json"/>

TO
<xsl:output indent="no" omit-xml-declaration="yes" method="xml" 
encoding="UTF-8" media-type="text/x-json"/>

Original comment by p.herm...@coolblue.nl on 4 Dec 2014 at 8:24