sitemule / noxDB

Not only XML. SQL,JSON and XML made easy for IBM i
MIT License
42 stars 20 forks source link

ParseString not escaping double quote #59

Closed worksofliam closed 2 years ago

worksofliam commented 2 years ago

For some reason, double quotes are not being escaped, but other characters are. Built from master.

**FREE

Ctl-Opt BNDDIR('NOXDB') DFTACTGRP(*NO);

/copy './headers/JSONPARSER.rpgle'

Dcl-S pJson              Pointer;
Dcl-S a                  VarChar(256);
Dcl-S b                  VarChar(256);
Dcl-S c                  VarChar(256);

pJson = json_ParseString (
    '{  +
        a:"A native unicode \u00b5 string",    +
        b:"A not native unicode \u2318 string",  +
        c:"Escaped: Backslash \\ newline \n double quote  \"  will be stored in their hex value"+
    }'
);

a  = json_getStr(pJson: 'a');
b  = json_getStr(pJson: 'b');
c  = json_getStr(pJson: 'c');

json_delete(pJson);

return;

image

worksofliam commented 2 years ago

jobBackSlash coming back as 00.

image

worksofliam commented 2 years ago

Tried this, but had the same result.

json_setDelimiters(json_DELIMITERS);
pJson = json_ParseString (
    '{  +
        a:"A native unicode \u00b5 string",    +
        b:"A not native unicode \u2318 string",  +
        c:"Escaped: Backslash \\ newline \n double quote  \"  will be stored in their hex value"+
    }'
);
worksofliam commented 2 years ago

Got it! A cool new API :)

json_setDelimitersByCcsid(0);
pJson = json_ParseString (
    '{  +
        a:"A native unicode \u00b5 string",    +
        b:"A not native unicode \u2318 string",  +
        c:"Escaped: Backslash \\ newline \n double quote  \"  will be stored in their hex value"+
    }'
);
NielsLiisberg commented 2 years ago

You are too fast !! Did not even have time to look at it !!

On Thu, Dec 9, 2021 at 9:38 PM barry @.***> wrote:

Closed #59 https://github.com/sitemule/noxDB/issues/59.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sitemule/noxDB/issues/59#event-5743433385, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVIPHT2W5563RLTMWNCZBDUQEHVBANCNFSM5JXM2G4A .