<link href='https://www.blogger.com/dyn-css/authorization.css?targetBlogID=2122001388027234627&amp;zx=65678e98-cebe-4fa0-8cfb-15a21e9d212f' rel='stylesheet'/>

Pages

Thursday, May 8, 2014

Rendertag to Escape Double Quote and Single Quote

This is a solution posted by Tim Davis on https://groups.google.com/forum/#!topic/reddot-cms-users/ImqWdAN4XIY

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

1
2
3
4
5
6
7
8
9
10
11
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

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

No comments:

Post a Comment