2B9A75E094B1481CA4C981324462D53F
  • Internet
  • 14.03.2018
  • EN

Simply RedDot: "Rendertag to Escape Double Quote and Single Quote"

written by Jian Huang, 8. May 2014
 

This is a solution posted by Tim Davis on RedDot CMS Users​ RenderTags caching issue.

You want to assign text placeholder content class a server side preexecution variable, but the text placeholder contains double quote, single quote and carriage return, which will cause preexecution error because the resulting code will be like this

Dim MyVar
MyVar = "<%txt_body%>"
 
'resulting code
'this cause syntax error, cannot have unescape quote inside quote
MyVar = "he says,"hello""
 
'this cause syntax error, cannot unclosed second line
MyVar = "first line
               second line"

What you can do is to use rendertag to escape the text. This method handles, &, ", ', accented character like (á, é, í, ó, ú, ü, ñ, ¿, ¡), and new line carriage return

Dim MyVar
MyVar = "<%!! Escape:HtmlEncode(<%txt_body%>) !!%>"

Source: Rendertag to Escape Double Quote and Single Quote

© copyright 2014 by Jian Huang