Tags:
create new tag
view all tags

Question

Advise on how to Protect Text From Interpretation

Consider the following form-based query

queryedit.jpg

Unfortunately, this query results in the following form:

<input type="hidden" name="format" value="| $topic | $formfield(Tool) | $formfield(Total) |"

I tried various ways of escaping the interpretation of the square brackets that apparently break the parsing of the whole line containing them. Any guidance would be greatly appreciated.

Environment

TWiki version: TWikiRelease01Feb2003
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: N/A
Web server: N/A
Perl version: N/A
Client OS: Win2k
Web Browser: IE 6

P.S. Sorry for the poor choice of title. Unfortunately, it is not possible to change the name on this wiki.

-- ThomasWeigert - 01 Jan 2004

Answer

This should work: Escape the link to show the value of
"| [<nop>[$topic]] | $formfield(Tool) | $formfield(Total) |", e.g.:

-- PeterThoeny - 02 Jan 2004

I changed the query above to
"| [<nop>[$topic]] | $formfield(TopicClassification) | $formfield(OperatingSystem) |"

TopicClassification) | $formfield(OperatingSystem) |" />

It turns out that one also has to escape the wiki words in the format. However, the wiki words in the header parameter do not need to be escaped:

Could you please explain the difference in how these are handled?

-- ThomasWeigert - 02 Jan 2004

This is because OperatingSystem in the header is bolded. The autolinking is only done for WikiWords preceeded by white space or opening parenthesis.

In the form you need to <nop>EscapeWikiWords one by one, or enclose the whole form in <noautolink> ... </noautolink> tags.

-- PeterThoeny - 02 Jan 2004

Thanks. However, the <noautolink> ... </noautolink> trick does not seem to work for me:

$topic | $formfield(TopicClassification) | $formfield(OperatingSystem) |" />

-- ThomasWeigert - 02 Jan 2004

<noautolink> only escapes WikiWord links as documented; the [[...][...]] links need to be escaped separately (as well as other TWiki rendering like bold etc)

-- PeterThoeny - 02 Jan 2004

I found another way to create a problem, as can be seen by the query below. As you can see, the insertion of HTML image reference messes up the rendering again:

]] | $formfield(TopicClassification) | $formfield(OperatingSystem) |" />

-- ThomasWeigert - 31 Jan 2005

Do this:

  • Use noautolink tags to prevent WikiWord linking
  • Entity encode special chars for use in input value parameter, such as %ENCODE{ "text to encode" type="entity" }%
  • No need to use nop tags
  • Double quotes need to be escaped with \"

Note that if you get the value via URLPARAM you can entity encode the value directly: value="%URLPARAM{ "foo" encode="entity" }%"

-- PeterThoeny - 06 Feb 2005

Note that when using %ENCODE% one cannot apply <nop> to protect linking (see the incorrect result):

However, <noautolink> can be applied at any level, and need not be around the whole form (in case linking within the form is desired, as in WebSearch):

Edit | Attach | Watch | Print version | History: r10 < r9 < r8 < r7 < r6 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r10 - 2005-02-07 - ThomasWeigert
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.