473,800 Members | 2,950 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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=javasc ript %>
<html>
<script language="javas cript">
function showEscapeVar() {
alert('<%=Reque st.QueryString( "escapevar").It em%>');
return false;
}
</script>
<body onload="showEsc apeVar()">
<a href="whoatemye scape.asp?escap evar=Sanford%20 %26%20Son">Href
Escape</a>

<a
href="javascrip t:open('whoatem yescape.asp?esc apevar=Sanford% 20%26%20Son')"> P
opup Escape</a>
</body>
</html>
Jul 23 '05 #1
1 1170
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=javasc ript %>
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="javas cript">
<script type="text/javascript">

See <http://validator.w3.or g/>
function showEscapeVar() {
alert('<%=Reque st.QueryString( "escapevar").It em%>');
AFAIK you can omit ".Item".
return false;
}
</script>
</head>
<body onload="showEsc apeVar()">
<a href="whoatemye scape.asp?escap evar=Sanford%20 %26%20Son">Href
Escape</a>

<a
href="javascrip t:open('whoatem yescape.asp?esc apevar=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
2675
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
2418
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 this: <?xml version="1.0" encoding="utf-8"?>
2
8425
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 vbscript escape function). I am have a terrible time 'unescaping' that string with C# under ASP.NET. I have tried the following: HttpUtility.UrlDecode HttpUtility.HtmlDecode (this should not work but I tried it)...
3
3463
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 little bit complicated in this beautiful language to me .....
7
9410
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
1556
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 outputs the following: var str=''; str+= // whatever text I want document.write(str);
12
1863
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 any match. My current approach is to look for matches in substrings with the escaped characters as boundaries between the substrings. However, then ^ and $ in the patterns are treated wrongly. (Although I use startpos and endpos parameters for...
9
11574
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, code point 205) would come out as "\303\215". I will also have to read back from the file later on and convert the escaped characters back into a unicode string.
0
929
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 sent to the server side aspx page. But it changes back to the original character ven it reach there.... is there any way to retain the escaped characters untill i send it to the database. I tried using HTTPUtility.urlEncode etc.. but it didnt worked...
0
9690
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9550
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10273
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10250
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5603
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2944
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.