Re: [WebDNA] Escaping content for JSON

This WebDNA talk-list message is from

2013


It keeps the original formatting.
numero = 110283
interpreted = N
texte = --047d7b67809ebdd95304d8d27433 Content-Type: text/plain; charset=UTF-8 Donovan, Thanks - that looks pretty good - I'll have a detailed look later on. Would be great if [convertchars] could deal with double-byte encodings ;-) Take care - Tom ============================================== Digital Revolutionaries 1st Floor, Castleriver House 14-15 Parliament Street Temple Bar,Dublin 2 Ireland ---------------------------------------------- [t]: + 353 1 4403907 [e]: [w]: ============================================== On 26 March 2013 05:54, Donovan Brooke wrote: > Tom Duke wrote: > >> Hi all, >> >> Trying to work out the best method of preparing content for use with >> JSON. My db charset is UTF-8 and it seems I need to use a >> [convertwords] and a [convertchars] to escape all of the required chars. >> >> Double quotes are not captured if I use just [convertchars]. Wondering >> if anyone else has come up with a cleaner solution. >> >> Thanks >> - Tom >> >> >> Conversion tables: >> >> [table name=jsonconvert&fields=from,**to] >> "\" >> \\\ >> /\/ >> [/table] >> >> [table name=jsonconvert2&fields=from,**to] >> %0B\n >> [/table] >> >> >> JSON output: >> >> { >> "label": "Title:", >> "name": "[convertchars table=jsonconvert2][**convertwords >> table=jsonconvert][theTitle][/**convertwords][/convertchars]" >> } >> > > > > Tom, > Here is what I came up with tonight: > > http://www.euca.us/admin/**tests/json_test.html > > Donovan > > > > > > -- > Donovan Brooke > WebDNA Software Corporation > http://www.webdna.us > **[Square Bracket Utopia]** > ------------------------------**--------------------------- > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > archives: http://mail.webdna.us/list/**talk@webdna.us > Bug Reporting: support@webdna.us > --047d7b67809ebdd95304d8d27433 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Donovan,

Thanks - that looks pret= ty good - I'll have a detailed look later on. =C2=A0 Would be great if = [convertchars] could deal with double-byte encodings ;-)
Take care
- Tom





=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Digital Revolutionaries
1st Floor, Castleriver House
14-15 Parliament= Street
Temple Bar,Dublin 2
Ireland
------------------------------= ----------------
[t]: + 353 1 4403907
[e]: <mailto:tom@revolutionaries.ie>=
[w]: <http:= //www.revolutionaries.ie/>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D


On 26 March 2013 05:54, Donovan Brooke <= span dir=3D"ltr"><dbrooke@webdna.us> wrote:
Tom Duke wrote:
Hi all,

Trying to work out the best method of preparing content for use with
JSON. =C2=A0 My db charset is UTF-8 and it seems I need to use a
[convertwords] and a [convertchars] to escape all of the required chars.
Double quotes are not captured if I use just [convertchars]. =C2=A0Wonderin= g
if anyone else has come up with a cleaner solution.

Thanks
- Tom


Conversion tables:

[table name=3Djsonconvert&fields=3Dfrom,to]
"\"
\\\
/\/
[/table]

[table name=3Djsonconvert2&fields=3Dfrom,to]
%0B\n
[/table]


JSON output:

{
"label": "Title:",
"name": "[convertchars table=3Djsonconvert2][convertw= ords
table=3Djsonconvert][theTitle][/convertwords][/convertchars]" }



Tom,
Here is what I came up with tonight:

http://www.euca.us/admin/tests/json_test.html

Donovan





--
Donovan Brooke
WebDNA Software Corporation
http://www.webdna.us=
**[Square Bracket Utopia]**
---------------------------------------------------------
This message is sent to you because you are subscribed to
the mailing list <ta= lk@webdna.us>.
To unsubscribe, E-mail to: <talk-leave@webdna.us>
archives: http://mail.webdna.us/list/talk@webdna.us
Bug Reporting: suppo= rt@webdna.us

--047d7b67809ebdd95304d8d27433-- Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] Escaping content for JSON (Stuart Tremain 2016)
  2. Re: [WebDNA] Escaping content for JSON (Tom Duke 2016)
  3. Re: [WebDNA] Escaping content for JSON (Tom Duke 2013)
  4. Re: [WebDNA] Escaping content for JSON (Donovan Brooke 2013)
  5. [WebDNA] Escaping content for JSON (Tom Duke 2013)
--047d7b67809ebdd95304d8d27433 Content-Type: text/plain; charset=UTF-8 Donovan, Thanks - that looks pretty good - I'll have a detailed look later on. Would be great if [convertchars] could deal with double-byte encodings ;-) Take care - Tom ============================================== Digital Revolutionaries 1st Floor, Castleriver House 14-15 Parliament Street Temple Bar,Dublin 2 Ireland ---------------------------------------------- [t]: + 353 1 4403907 [e]: [w]: ============================================== On 26 March 2013 05:54, Donovan Brooke wrote: > Tom Duke wrote: > >> Hi all, >> >> Trying to work out the best method of preparing content for use with >> JSON. My db charset is UTF-8 and it seems I need to use a >> [convertwords] and a [convertchars] to escape all of the required chars. >> >> Double quotes are not captured if I use just [convertchars]. Wondering >> if anyone else has come up with a cleaner solution. >> >> Thanks >> - Tom >> >> >> Conversion tables: >> >> [table name=jsonconvert&fields=from,**to] >> "\" >> \\\ >> /\/ >> [/table] >> >> [table name=jsonconvert2&fields=from,**to] >> %0B\n >> [/table] >> >> >> JSON output: >> >> { >> "label": "Title:", >> "name": "[convertchars table=jsonconvert2][**convertwords >> table=jsonconvert][theTitle][/**convertwords][/convertchars]" >> } >> > > > > Tom, > Here is what I came up with tonight: > > http://www.euca.us/admin/**tests/json_test.html > > Donovan > > > > > > -- > Donovan Brooke > WebDNA Software Corporation > http://www.webdna.us > **[Square Bracket Utopia]** > ------------------------------**--------------------------- > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > archives: http://mail.webdna.us/list/**talk@webdna.us > Bug Reporting: support@webdna.us > --047d7b67809ebdd95304d8d27433 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Donovan,

Thanks - that looks pret= ty good - I'll have a detailed look later on. =C2=A0 Would be great if = [convertchars] could deal with double-byte encodings ;-)
Take care
- Tom





=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Digital Revolutionaries
1st Floor, Castleriver House
14-15 Parliament= Street
Temple Bar,Dublin 2
Ireland
------------------------------= ----------------
[t]: + 353 1 4403907
[e]: <mailto:tom@revolutionaries.ie>=
[w]: <http:= //www.revolutionaries.ie/>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D


On 26 March 2013 05:54, Donovan Brooke <= span dir=3D"ltr"><dbrooke@webdna.us> wrote:
Tom Duke wrote:
Hi all,

Trying to work out the best method of preparing content for use with
JSON. =C2=A0 My db charset is UTF-8 and it seems I need to use a
[convertwords] and a [convertchars] to escape all of the required chars.
Double quotes are not captured if I use just [convertchars]. =C2=A0Wonderin= g
if anyone else has come up with a cleaner solution.

Thanks
- Tom


Conversion tables:

[table name=3Djsonconvert&fields=3Dfrom,to]
"\"
\\\
/\/
[/table]

[table name=3Djsonconvert2&fields=3Dfrom,to]
%0B\n
[/table]


JSON output:

{
"label": "Title:",
"name": "[convertchars table=3Djsonconvert2][convertw= ords
table=3Djsonconvert][theTitle][/convertwords][/convertchars]" }



Tom,
Here is what I came up with tonight:

http://www.euca.us/admin/tests/json_test.html

Donovan





--
Donovan Brooke
WebDNA Software Corporation
http://www.webdna.us=
**[Square Bracket Utopia]**
---------------------------------------------------------
This message is sent to you because you are subscribed to
the mailing list <ta= lk@webdna.us>.
To unsubscribe, E-mail to: <talk-leave@webdna.us>
archives: http://mail.webdna.us/list/talk@webdna.us
Bug Reporting: suppo= rt@webdna.us

--047d7b67809ebdd95304d8d27433-- Tom Duke

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

FW: 2.01 upgrade problems (1997) docs for WebCatalog2 (1997) Error: this shopping cart has already been submitted and (2006) frames & carts (1997) New since last visit, forum feature, help requested (2004) emailer (1997) [OT] HTML, HTML docs (2001) Emailer problems. (1998) [WebDNA] after latest OSX upgrade, WebDNA not running? (2011) EMailer - WebSTAR V - OSX - WebDNA (2003) PCS Frames (1997) New command suggestion (was Modifying databasesmanually) (1997) Re requiredFields parameter (1998) Need formatting help (1998) WebCat virtual postcard is done! Thanks for the help! (1998) Include a big block of text (1997) WebCatalog can't find database (1997) WebCat2b13 Mac plugin - [sendmail] and checkboxes (1997) TCP Connect/send and CGI (2003) [SHOWIF AND/OR] (1997)