NetTalk Central

Author Topic: Passing special chars ? % in addressline  (Read 8228 times)

Bram Klootwijk

  • Newbie
  • *
  • Posts: 22
    • View Profile
    • Email
Passing special chars ? % in addressline
« 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

Rene Simons

  • Hero Member
  • *****
  • Posts: 649
    • View Profile
Re: Passing special chars ? % in addressline
« Reply #1 on: July 25, 2007, 02:28:22 AM »
Bram,
If I'm right, you will have to 'escape' the '%' character.
You can do that by putting &#037 in the place of the '%' character.
The code will be RD12&#037  .
037 is the ascii code for % .

Hope it helps you out

Rene Simons
Rene Simons
NT14.14

Rene Simons

  • Hero Member
  • *****
  • Posts: 649
    • View Profile
Re: Passing special chars ? % in addressline
« Reply #2 on: July 25, 2007, 02:38:13 AM »
Sorry,

that would be The code will be RD12&#037  .

Rene
Rene Simons
NT14.14

Bram Klootwijk

  • Newbie
  • *
  • Posts: 22
    • View Profile
    • Email
Re: Passing special chars ? % in addressline
« Reply #3 on: July 25, 2007, 05:20:10 AM »
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

Bram Klootwijk

  • Newbie
  • *
  • Posts: 22
    • View Profile
    • Email
Re: Passing special chars ? % in addressline
« Reply #4 on: July 25, 2007, 05:42:28 AM »
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

Rene Simons

  • Hero Member
  • *****
  • Posts: 649
    • View Profile
Re: Passing special chars ? % in addressline
« Reply #5 on: July 25, 2007, 05:58:00 AM »
Rene Simons
NT14.14

Bram Klootwijk

  • Newbie
  • *
  • Posts: 22
    • View Profile
    • Email
Re: Passing special chars ? % in addressline
« Reply #6 on: July 25, 2007, 06:04:21 AM »
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

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11179
    • View Profile
Re: Passing special chars ? % in addressline
« Reply #7 on: July 31, 2007, 11:50:54 PM »
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


Rene Simons

  • Hero Member
  • *****
  • Posts: 649
    • View Profile
Re: Passing special chars ? % in addressline
« Reply #8 on: August 01, 2007, 08:32:41 AM »
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 Simons
NT14.14

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11179
    • View Profile
Re: Passing special chars ? % in addressline
« Reply #9 on: August 01, 2007, 10:10:40 AM »
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


Rene Simons

  • Hero Member
  • *****
  • Posts: 649
    • View Profile
Re: Passing special chars ? % in addressline
« Reply #10 on: August 01, 2007, 01:37:27 PM »
Yeah Yeah.........
Thanks in advance :D
Rene Simons
NT14.14