Tags:
create new tag
view all tags
#VarENTITY ---+++ ENTITY{string} -- encode a string to HTML entities * Encode "special" characters to HTML entities. Useful to encode text properly for HTML input fields. * Encoded characters: * all non-printable ASCII characters below space, including newline (="\n"=) and linefeed (="\r"=) * Space * HTML special characters ="<"=, =">"=, ="&"=, single quote (='=) and double quote (="=) * TWiki special characters ="%"=, ="["=, ="]"=, ="@"=, ="_"=, ="*"=, ="="= and ="|"= * Syntax: =%<nop>ENTITY{string}%= * Example: =%<nop>ENTITY{text with "quotes" and%BR%newline}%= expands to =text&#32;with&#32;&#34;quotes&#34;&#32;and&#10;newline= * __Notes:__ * To protect against [[http://en.wikipedia.org/wiki/Cross-site_scripting][cross-site scripting]] (XSS), __always__ entity encode text intended for HTML input fields. This is especially true if text is received dynamically via URLPARAM or the like. %BR% Example: =<input type="text" name="address" value="%<nop>ENTITY{any text}%" />= * =%<nop>ENTITY{string}%= is roughly equivalent to =%<nop>ENCODE{ "string" type="html" }%=, but the latter cannot handle strings that have double quotes embedded in it. * Category: DevelopmentVariables, FormattingAndRenderingVariables, ExportAndPublishingVariables * Related: [[%IF{"'%INCLUDINGTOPIC%'='TWikiVariables'" then="#"}%VarENCODE][ENCODE]], [[%IF{"'%INCLUDINGTOPIC%'='TWikiVariables'" then="#"}%VarFORMFIELD][FORMFIELD]], [[%IF{"'%INCLUDINGTOPIC%'='TWikiVariables'" then="#"}%VarQUERYPARAMS][QUERYPARAMS]], [[%IF{"'%INCLUDINGTOPIC%'='TWikiVariables'" then="#"}%VarURLPARAM][URLPARAM]]
E
dit
|
A
ttach
|
Watch
|
P
rint version
|
H
istory
: r1
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r1 - 2012-11-12
-
TWikiContributor
Home
Site map
Sandbox web
TWiki web
XPDays2010 web
XPDays2011 web
XPDays2011SponsoringDemo web
XPDays2012 web
TWiki Web
User registration
Users
Groups
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
P
View
Raw View
Print version
Find backlinks
History
More topic actions
Edit
Raw edit
Attach file or image
Edit topic preference settings
Set new parent
More topic actions
User Reference
ATasteOfTWiki
TextFormattingRules
TWikiVariables
FormattedSearch
QuerySearch
TWikiDocGraphics
TWikiSkinBrowser
InstalledPlugins
Admin Maintenance
Reference Manual
InterWikis
ManagingUsers
ManagingWebs
TWikiSiteTools
TWikiPreferences
WebPreferences
Categories
Admin Documentation
Admin Tools
Developer Doc
User Documentation
User Tools
Account
Log In
Register User
E
dit
A
ttach
Copyright © 1999-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback
Note:
Please contribute updates to this topic on TWiki.org at
TWiki:TWiki.VarENTITY
.