NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: Bram Klootwijk on July 25, 2007, 01:31:09 AM
-
Hi,
is there a method for URL-encoding /decoding to pass special characters from one page to another page?
I must pass ariclenumbers like "DG12%" .
Thanx,
Bram
-
Bram,
If I'm right, you will have to 'escape' the '%' character.
You can do that by putting % in the place of the '%' character.
The code will be RD12% .
037 is the ascii code for % .
Hope it helps you out
Rene Simons
-
Sorry,
that would be The code will be RD12% .
Rene
-
Hi Ren
i think it's not working because it is displayed in the URL address as %. In the URL line a % is a special chariacter, so it has to be escaped with special characters.
I.e. : & is %amp% (i think for XML).
If there is a routine in Nettalk webserver that does this for me, then i can use that routine. Otherwise i will have to search and replace strings that are to be used in het URL.
What i need is a parser.
Maybe Bruce has an answer?
Thanx for helping!
Bram
-
Hi Rene,
found an interesting url on this topic:
http://www.blooberry.com/indexdot/html/topics/urlencoding.htm
You need to use a % followed by the hex represntation of the character. Then it works ok.
But still i have to search every string myself...
I hope there is an easy way.
Greetings,
Bram
-
Bram,
Look at this page
http://www.w3schools.com/jsref/jsref_escape.asp
Rene
-
Rene, in that page is a note:
Note: The escape() and unescape() functions should not be used to encode or decode URIs. Use encodeURI() and decodeURI() functions instead!
That's what i mean buy using a parser in Webserver.
Cheers,
Bram
-
There's a method called "Escape" which will do this for you.
So if you have a string (let's call it Fil:Name) and you want to use it as a URL, and it might contain icky characters, then do
p_web.Escape(fil:name)
Some other methods that might be useful :
p_web._noColon: removes colons from variable and procedure names. This is necessary because HTML doesn't allow colons in variable names. You'll see this method called for you a lot by the template. You shouldn't need to use it yourself unless you are doing fancy hand-coded things.
p_web._jsok: data passed to the browser has to be valid XHTML. This is especially true of stuff passed asynchronously (like a browse update). the _jsok method encodes characters that would break the XML. (like \ or < etc)
cheers
Bruce
-
Bruce,
Since the number of methods is growing I wonder if there is a document which summs up the methods with a description of each one???
Or am I asking for the world now?
Rene
-
Rene,
One day mate, one day...
I'd like to see the class settle down quite a bit though before I tackle that job.
Cheers
Bruce
-
Yeah Yeah.........
Thanks in advance :D