Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > special character "&" and " ' " in request.querystring URL

Reply
Thread Tools

special character "&" and " ' " in request.querystring URL

 
 
magix8@gmail.com
Guest
Posts: n/a
 
      02-17-2008
Hi all,


how can I pass the special characters as request.querystring value ?
example like "&", since & is used in request.querystring for various
parameters value

It will be cut off until "pass" in text 1, for example

let say:
text1 = "I want to pass & chacater"

test.asp?Text1=<%=text1%>

should I use Server.URLEncode ? But Server.URLEncode doesn't seems to
work either as I tried
I read some ppl suggested using replace method to replace "&" with
normal letters, and at receiving, replace back with "&", but is there
a better one ?

Special characters like ' ' and & are having problem in
request.querystring URL

Any suggestions or workaround ?

Thanks.

cheers,
Magix
 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      02-17-2008
wrote on 17 feb 2008 in
microsoft.public.inetserver.asp.general:

> how can I pass the special characters as request.querystring value ?
> example like "&", since & is used in request.querystring for various
> parameters value
>
> It will be cut off until "pass" in text 1, for example
>
> let say:
> text1 = "I want to pass & chacater"
>
> test.asp?Text1=<%=text1%>
>
> should I use Server.URLEncode ? But Server.URLEncode doesn't seems to
> work either as I tried
> I read some ppl suggested using replace method to replace "&" with
> normal letters, and at receiving, replace back with "&", but is there
> a better one ?
>
> Special characters like ' ' and & are having problem in
> request.querystring URL
>
> Any suggestions or workaround ?


Use VBS Escape()

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
 
Reply With Quote
 
 
 
 
magix8@gmail.com
Guest
Posts: n/a
 
      02-17-2008
On Feb 17, 5:14*pm, "Evertjan." <exjxw.hannivo...@interxnl.net> wrote:
> mag...@gmail.com wrote on 17 feb 2008 in
> microsoft.public.inetserver.asp.general:
>
>
>
>
>
> > how can I pass the special characters as request.querystring value ?
> > example like "&", since & is used in request.querystring for various
> > parameters value

>
> > It will be cut off until "pass" in text 1, for example

>
> > let say:
> > text1 = "I want to pass & chacater"

>
> > test.asp?Text1=<%=text1%>

>
> > should I use Server.URLEncode ? But Server.URLEncode doesn't seems to
> > work either as I tried
> > I read some ppl suggested using replace method to replace "&" with
> > normal letters, and at receiving, replace back with "&", but is there
> > a better one ?

>
> > Special characters like ' ' and & *are having problem in
> > request.querystring URL

>
> > Any suggestions or workaround ?

>
> Use VBS Escape()
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)- Hide quoted text -
>
> - Show quoted text -




I used:
<script>

var vQText = document.getElementById("Text1").value;
var result = vQText.replace(/&/gi, "%26"); // replace ampersand
</script>

It works fine.

But for single quote, it doesn't seem working.
i.e var result = vQText.replace(/'/gi, "%27"); // replace single quote

 
Reply With Quote
 
Evertjan.
Guest
Posts: n/a
 
      02-17-2008
wrote on 17 feb 2008 in
microsoft.public.inetserver.asp.general:

>> > Any suggestions or workaround ?

>>
>> Use VBS Escape()
>>


[please do not quote signatures on usenet]

> I used:
> <script>
>
> var vQText = document.getElementById("Text1").value;
> var result = vQText.replace(/&/gi, "%26"); // replace ampersand
> </script>
>
> It works fine.
>
> But for single quote, it doesn't seem working.
> i.e var result = vQText.replace(/'/gi, "%27"); // replace single quote


Why noy do this serverside as I suggested?

>> text1 = "I want to pass & chacater"
>> test.asp?Text1=<%=text1%>


ASP-VBS:

<% text1 = "I want to pass & chacater" %>

<a href = 'test.asp?Text1=<% = Escape(text1) %>'>

or

ASP-JS:

<% text1 = 'I want to pass & chacater'; %>

<a href = 'test.asp?Text1=<% = escape(text1); %>'>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
 
Reply With Quote
 
Daniel Crichton
Guest
Posts: n/a
 
      02-18-2008
wrote on Sun, 17 Feb 2008 00:06:55 -0800 (PST):

> Hi all,



> how can I pass the special characters as request.querystring value ?
> example like "&", since & is used in request.querystring for various
> parameters value


> It will be cut off until "pass" in text 1, for example


> let say:
> text1 = "I want to pass & chacater"


> test.asp?Text1=<%=text1%>


> should I use Server.URLEncode ? But Server.URLEncode doesn't seems to
> work either as I tried
> I read some ppl suggested using replace method to replace "&" with
> normal letters, and at receiving, replace back with "&", but is there a
> better one ?


What didn't work with Server.URLEncode?

Response.Write Server.URLEncode("I want to pass & character")

spits out

I+want+to+pass+%26+character

which is correct.

Did you try

test.asp?Text1=<%=Server.URLEncode(text1)%>

--
Dan


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Special Report: How special are you? Death from Above MCSE 2 03-19-2007 07:22 PM
URL 'special character' replacements Claude Henchoz Python 6 01-09-2006 01:58 PM
Re: html special character and escape characters knowledgepays@hotmail.com ASP .Net 0 01-27-2005 02:08 AM
Special editions and Deluxe special edition dvd question. Rclrk43 DVD Video 8 12-29-2004 07:32 PM
redirect URL's, return URL's, and URL Parameters Jon paugh ASP .Net 1 07-10-2004 05:29 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57