• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.
The long-time definition of TWiki variables specifies \" and \' as escapes for " and ' respectively in parameter values. This allows you to write:

%FORMFIELD{"Priority" format="\" double \' single"}%

to get

" double ' single

Unfortunately \ is no similarly escaped, so there is no way to include the strings \" and \' in the parameters to a TWiki variable. Try it.

The immediate fix to this is to handle \\ as an escape for \, which would allow you to write


to get


This is a two-character fix in Attrs.pm, though the AttrsTests unit testcase should also be updated.

I consider this as Urgent because that string is needed to escape a quote in an enclosing TWiki variable - for example,

%SEARCH{"%FORMFIELD{"AFormField" format="\\\"$value\\\""}%"}%

This is a gotcha that has already bitten many people, including me.

At the same time it might be sensible to support escapes for other elements of TWiki syntax, such as \% and \}. This would make it significantly easier to use TWiki Variables, especially when used with Peter's new %ENCODE{type="quote"}% However this is a more extensive change, as it impacts the twiki variable parser as well.

Perhaps over time we will also be able to replace, or at least provide an alternative to, the $quot and $percnt style of escapes that alienate so many people.


I agree that this needs to be resolved. However, I do not think that this should be blocking the 4.1.0 release, hence changing this to "enhancement" state. This enhancement would be risky to introduce showtly before the release.

-- PTh

After tripping over this several times while working on the query lookup, I am raising it again to Normal. It needs to be fixed.


Outch. This broke all of my twiki apps. I now happen to need three backslashes to get one. I only needed two to get one before. Reopening, marked as urgent.

The problem appears on a string like \\" which was translated to \" before in Attrs.pm. Two blackslashes \\ are now escaped and \" not, thus the attribute values are truncated wrongly. That's because the code uses a translation token at the wrong place producing an interim string like ^@92" now (^@92 encodes \\). Before the interim string was \^@32 which encodes \".

So the sequence \\" is ambiguous to be translated either to ^@92" or \^@32 and this precedence changed unfortunately.

Wrt the above example, did you ever try

%SEARCH{"%FORMFIELD{"AFormField" format="\\"$value\\""}%"}%

An isolated backslash followed by something else but a " or a ' had no meaning for the Attrs parser before.


OK, given that Michael is having problems I imagine that means other people will as well. So I will revert the testcase as well.

This report is rejected.


Summary Impossible to pass \" in a value to a TWiki variable
ReportedBy TWiki:Main.CrawfordCurrie
Codebase ~twiki4
SVN Range TWiki-4.1.0, Thu, 04 Jan 2007, build 12435
AppliesTo Engine

Priority Urgent
CurrentState Closed

Checkins TWikirev:13704 TWikirev:13970 TWikirev:13994
TargetRelease n/a

Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r7 - 2007-05-31 - TWikiUserMapping_CrawfordCurrie
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback