[Zope] Character Swapping / Mapping
Pavlos Christoforou
pavlos@gaaros.com
Sat, 26 Feb 2000 18:12:12 -0500 (EST)
On Sat, 26 Feb 2000 Jatwood@bwanazulia.com wrote:
>
> I have an URL coming out of a database like "http://www.myplace.com"
> and need to pass it to another website but they want it in the format
> of "http%3A%2F%2Fwww%2Emyplace%2Ecom". Is there a simple method to
> do this with or some sort of VAR tag? If not, what is the find and
> replace tag?
<dtml-var <variable holding URL> fmt=url-quote> will do most of what you
want. It won't
convert the dots though.
Alternatively you can use the _.string module. For instance you can have
DTMLMethod with id test like:
<dtml-return "_.string.replace(url,'.','%2E')">
and call it from DTML or directly:
http://<spamaddress>/test?url=http://www.myplace.com
it will return
http://www%2Emyplace%2Ecom
Add a few more replace to convert all the characters you want.
Pavlos