The @KEEP is fine except for the &quot; in which case you should use <@DQ>, and 
I wouldn’t keep any characters greater than 127 (really, these should be 
converted into Unicode hex, like \u00A1)



We just added encoding=json to properly encode JSON strings, it will be 
available in the 7.1 release.



You can create your own JSON encoder (perhaps imperfect, but it should work) 
with a series of @REPLACE:



<@DQ> to \<@DQ>

/ to \/

<@CHAR 9> to \t

<@CHAR 10> to \n

<@CHAR 13> to \r

\ to \\ (must do this one last)



And then you don’t do the encoding=html



Robert





From: [email protected] [mailto:[email protected]]
Sent: Tuesday, March 24, 2015 1:04 PM
To: [email protected]
Subject: TeraScript-Talk: Using JSON and KEEP



Hi,



In one of my TeraScript app I have the following JSON structure to display on a 
table for export.



{

"data":[

{

"app_id":"appid",

"app_number":"12345",

"app_question":"<@VAR NAME="question" SCOPE="LOCAL" encoding='html'>",

"app_answer":"<@VAR NAME="answer" SCOPE="LOCAL" encoding='html'>",

"app_dummy":""

}

]}



The "answer" var contains a large block of text with paragraph, quotes, and all 
other displayable characters and it works fine. But, if the "answer" var 
contain hidden characters that do not display on any html page, it will fail.



I also tried to use the <@KEEP> to keep the normal characters and not picking 
up the hidden characters and the "answer" var seems to work except it didn't 
KEEP the quote and any characters using <@CHAR CODE=''>



The CHARS='' parameter within my KEEP is as follows:



CHARS='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890 
-_:;,./!@#$%&*()+=[]{}?|<@CHAR CODE=147><@CHAR CODE=148>\&quot;<@CHAR 
CODE=10><@CHAR CODE=13><@CHAR CODE=147><@CHAR CODE=148><@SQ>'



Please advise me with a better solution in populating the "answer" var for the 
JSON structure or how to use the <@KEEP> to keep the characters as shown above.



Thank you!



MC



  _____

To unsubscribe from this list, please send an email to [email protected] 
<mailto:[email protected]>  with "unsubscribe terascript-talk" in the 
body.




----------------------------------------

To unsubscribe from this list, please send an email to [email protected] 
with "unsubscribe terascript-talk" in the body.

Reply via email to