Hello All! I'm having a little problem: newlines in TEXTAREAS used to enter forms are encoded as %0D%0A by url_quote which is standard (newline+return). however, this data is loaded by a Flash file (through a loadvariables call), and Flash renders 2 newlines instead of just one (treating both %0D and %0A as new lines). There seems to be no way to instruct flash to ignore one of them. Is there an elegant way to prevent one to happen in Zope? Is it possible to add my own "url_quote_single" to the dtml-var tag, which i guess could be a url_quote wrapped in a string.replace? I'm using url_quote quite heavily (all the site data goes through it), so an efficient solution is hoped for... THanks! Alex.
Is it possible to add my own "url_quote_single" to the dtml-var tag, which i guess could be a url_quote wrapped in a string.replace?
I'm using url_quote quite heavily (all the site data goes through it), so an efficient solution is hoped for...
It's possible! Create a Hotfix/patch that adds it. There are some howtos on zope.org on hotfixing. Basically, you import DT_Var from DocumentTemplate and change what needs to be changed. To know what to do, simple look at url_quote and try to copy that. peter
newlines in TEXTAREAS used to enter forms are encoded as %0D%0A by url_quote which is standard (newline+return).
That's 'cos newlines returned by text areas vary from system to system and browser to browser ;-) I'd use a regex to turn them all into single \n's... There's probably in in Squishdot's Utility.py if you're interested. cheers, Chris
Alex Burton writes:
newlines in TEXTAREAS used to enter forms are encoded as %0D%0A by url_quote which is standard (newline+return). however, this data is loaded by a Flash file (through a loadvariables call), and Flash renders 2 newlines instead of just one (treating both %0D and %0A as new lines). You can give them the ":text" type suffix and line endings will be normalized on input to Zope.
See (e.g.) the "ZPublisher" section of URL:http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html for details. Dieter
participants (4)
-
Alex Burton -
Chris Withers -
Dieter Maurer -
Peter Bengtsson