Download & Extend

how to escape square brackets?

Project:Token
Version:6.x-1.12
Component:Miscellaneous
Category:feature request
Priority:critical
Assigned:Unassigned
Status:closed (won't fix)

Issue Summary

I'm using flag with token and there is a problem when I when to put a url in flag message form.

what I need is:
http://bhuntr.com/node/add/forum/14?edit[field_related_match][0][nid]=123
which '123' is the node id. So I type in:
http://bhuntr.com/node/add/forum/14?edit[field_related_match][0][nid]=[nid]
but it comes out:
http://bhuntr.com/node/add/forum/14?edit[field_related_match][0]123=123

how do I use the square brackets in my form without being converted?

Comments

#1

Ha! thought someone would have this issue too :) for me it was in the custom_links module.

I used percent url encoding to escape it

[ => %5B
] => %5D

so ?edit[field_related_match][0][nid]=123 => edit[field_related_match][0]%5Bnid%5D=123 did the trick. Does anyone think there should be a more elegant solution? maybe [\nid\] would work?

#2

Status:active» closed (won't fix)

Special characters like that always need to be encoded. It's kind of a common knowledge kinda thing. There's not a good place to document this here.

#3

So thankful for this solution. I was about to go crazy trying to craft a prepopulate link in a views "Rewrite the output of this field" which is not only token-enabled, but argument-enabled -- which thwarted my attempts to escape the "n" "i" "d" characters... bravo.