473,387 Members | 1,365 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Hey, who keeps chaning my escaped character!

The sample below demonstates an issue that I cannot seem to workaround. I
have an Url with a value that contains an ampersand. I have escaped the Url
using both the hex value and it works fine when used in a href. But, if I
pass the same Url to the open() function it unescapes my ampersand while
leaving the other escaped untouched. This behavior is the same for both IE
and Mozilla Firefox, I guess this is known behvoir unknown to me.

Does anybody know how to pass an ampersand in a name value pair to the open
function?

Sample:

<%@ Language=javascript %>
<html>
<script language="javascript">
function showEscapeVar() {
alert('<%=Request.QueryString("escapevar").Item%>' );
return false;
}
</script>
<body onload="showEscapeVar()">
<a href="whoatemyescape.asp?escapevar=Sanford%20%26%2 0Son">Href
Escape</a>

<a
href="javascript:open('whoatemyescape.asp?escapeva r=Sanford%20%26%20Son')">P
opup Escape</a>
</body>
</html>
Jul 23 '05 #1
1 1150
Rob Morrison wrote:
Does anybody know how to pass an ampersand in a name value pair to the
open function?
`&amp;', if window.open() is called in an event handler.
Sample:

<%@ Language=javascript %>
This should be

<%@ LANGUAGE = JScript %>
<html>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTMl 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>...</title>
<script language="javascript">
<script type="text/javascript">

See <http://validator.w3.org/>
function showEscapeVar() {
alert('<%=Request.QueryString("escapevar").Item%>' );
AFAIK you can omit ".Item".
return false;
}
</script>
</head>
<body onload="showEscapeVar()">
<a href="whoatemyescape.asp?escapevar=Sanford%20%26%2 0Son">Href
Escape</a>

<a
href="javascript:open('whoatemyescape.asp?escapeva r=Sanford%20%26%20Son')">P
^^^^^^^^^^
<http://jibbering.com/faq/#FAQ4_24>
opup Escape</a>


Don't depend on client-side scripting when you are not required
to. You have ASP available, make use of it whereever possible.
PointedEars
--
Clarity of thought before rashness of action.
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Jay | last post by:
Is there a definitive list of characters that must be escaped in order to insert them into a text field in mysql? TIA, Jay
4
by: Johannes Busse | last post by:
Hello NG, I'm struggling with the following problem. I think can be solved quite easily (in fact it should be a FAQ), but it seems that I cannot solve it myself :-( my source looks like...
2
by: Vance Kessler | last post by:
We are trying write a new ASP.NET page to work with an existing stateless ASP application. The ASP application creates a cookie and of course stores the cookie values as escaped strings (using the...
3
by: Petr Jakes | last post by:
Hi, I am trying to convert string to the "escaped string". example: from "0xf" I need "\0xf" I am able to do it like: a="0xf" escaped_a=("\%s" % a ).decode("string_escape") But it looks a...
7
by: Jonny | last post by:
Hi, I am trying to write a C function which will dequote the string in a char * variable, and unescape any escaped quotes, so that, for example: "hello" would become: hello
4
by: Trev | last post by:
Hi everyone, Thanks to all who have helped with various issues in the past. I've come up with a new one though: I've run some html through a javascript converter; basically it takes the html and...
12
by: Torsten Bronger | last post by:
Hallchen! I need some help with finding matches in a string that has some characters which are marked as escaped (in a separate list of indices). Escaped means that they must not be part of...
9
by: Michael Goerz | last post by:
Hi, I am writing unicode stings into a special text file that requires to have non-ascii characters as as octal-escaped UTF-8 codes. For example, the letter "Í" (latin capital I with acute,...
0
by: hash4sp | last post by:
Hello ! I have a problem with the escaped charactes which I am sending to an aspx page. This is an escaped (javascript) %u0646%u062A%u0627%u0626%u062C%20%u0627%u0644%u0628%u062D%u062B which i...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.