473,545 Members | 2,049 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What Happens To Escape Characters?

I'd like to know the answer to the following question so I can know what to
expect with regard to other similar uses of escape characters and strings.
While everything works fine - I'd like to know specifically why:

I am building a simple HTML table in my C# code-behind by concatenating
strings that contain different parts of the table and table content...
something like this:

string myTable = "<table width=\"100%\" border=\"0\" cellspacing=\"0 \"
cellpadding=\"0 px\" class=\"myCSSCl ass\"><tr><td>" ;

Notice the back-slash (\) character which is there to escape each of the
double-quote (") characters.

After the table is finished being constructed, it exists in one string
variable - which I HtmlEncode prior to returning to the caller.

The calling method then HtmlDecodes that string, and for testing purposes
renders to the browser via Response.Write( ). The table renders just
beautifully. While that is good news, I'm curious as to what is happening to
the \ escape characters. They are all present in the HtmlDecoded string, of
course - which is fed into Response.Write( ). The value of the string that
shows up in the browser (i.e., the <table> definition) does *not* have the
escape characters (at least as the browser shows the rendered page). So,
when were they removed, and what removed them?

In trying to determine where the escape characters are being removed (client
or server side), I pasted the string value with the escape characters (the
value that is fed to Response.Write( )) directly into the ASPX file - and it
failed to render correctly, as all of the escape characters were present.
So, apparently the browser is not removing them. What specifically is
removing them?

Thanks!

Nov 18 '05 #1
3 2226
The escape characters are removed once you compile the project.

They are there to tell the compiler you really want to input a ' " ' and not
to terminate the string, so no point to keep them after the project is
built.

"Guadala Harry" <GM**@NoSpam.co m> ¦b¶l¥ó
news:Ow******** ******@TK2MSFTN GP09.phx.gbl ¤¤¼¶¼g...
I'd like to know the answer to the following question so I can know what to expect with regard to other similar uses of escape characters and strings.
While everything works fine - I'd like to know specifically why:

I am building a simple HTML table in my C# code-behind by concatenating
strings that contain different parts of the table and table content...
something like this:

string myTable = "<table width=\"100%\" border=\"0\" cellspacing=\"0 \"
cellpadding=\"0 px\" class=\"myCSSCl ass\"><tr><td>" ;

Notice the back-slash (\) character which is there to escape each of the
double-quote (") characters.

After the table is finished being constructed, it exists in one string
variable - which I HtmlEncode prior to returning to the caller.

The calling method then HtmlDecodes that string, and for testing purposes
renders to the browser via Response.Write( ). The table renders just
beautifully. While that is good news, I'm curious as to what is happening to the \ escape characters. They are all present in the HtmlDecoded string, of course - which is fed into Response.Write( ). The value of the string that
shows up in the browser (i.e., the <table> definition) does *not* have the
escape characters (at least as the browser shows the rendered page). So,
when were they removed, and what removed them?

In trying to determine where the escape characters are being removed (client or server side), I pasted the string value with the escape characters (the
value that is fed to Response.Write( )) directly into the ASPX file - and it failed to render correctly, as all of the escape characters were present.
So, apparently the browser is not removing them. What specifically is
removing them?

Thanks!

Nov 18 '05 #2
Thanks - now just to be clear - this all has *nothing* to do with browsers
or asp.net or html, and same would apply for any .NET project type?

-G
"Lau Lei Cheong" <le****@yehoo.c om.hk> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
The escape characters are removed once you compile the project.

They are there to tell the compiler you really want to input a ' " ' and not to terminate the string, so no point to keep them after the project is
built.

"Guadala Harry" <GM**@NoSpam.co m> ¦b¶l¥ó
news:Ow******** ******@TK2MSFTN GP09.phx.gbl ¤¤¼¶¼g...
I'd like to know the answer to the following question so I can know what to
expect with regard to other similar uses of escape characters and strings. While everything works fine - I'd like to know specifically why:

I am building a simple HTML table in my C# code-behind by concatenating
strings that contain different parts of the table and table content...
something like this:

string myTable = "<table width=\"100%\" border=\"0\" cellspacing=\"0 \"
cellpadding=\"0 px\" class=\"myCSSCl ass\"><tr><td>" ;

Notice the back-slash (\) character which is there to escape each of the
double-quote (") characters.

After the table is finished being constructed, it exists in one string
variable - which I HtmlEncode prior to returning to the caller.

The calling method then HtmlDecodes that string, and for testing purposes renders to the browser via Response.Write( ). The table renders just
beautifully. While that is good news, I'm curious as to what is happening to
the \ escape characters. They are all present in the HtmlDecoded string,

of
course - which is fed into Response.Write( ). The value of the string

that shows up in the browser (i.e., the <table> definition) does *not* have the escape characters (at least as the browser shows the rendered page). So,
when were they removed, and what removed them?

In trying to determine where the escape characters are being removed

(client
or server side), I pasted the string value with the escape characters (the value that is fed to Response.Write( )) directly into the ASPX file - and

it
failed to render correctly, as all of the escape characters were present. So, apparently the browser is not removing them. What specifically is
removing them?

Thanks!


Nov 18 '05 #3
Yes unless your code is on any of the client side script, where they are
sent as plain text to browsers and then get interpreted.

"Guadala Harry" <GM**@NoSpam.co m> ¦b¶l¥ó
news:uB******** ******@TK2MSFTN GP09.phx.gbl ¤¤¼¶¼g...
Thanks - now just to be clear - this all has *nothing* to do with browsers
or asp.net or html, and same would apply for any .NET project type?

-G
"Lau Lei Cheong" <le****@yehoo.c om.hk> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
The escape characters are removed once you compile the project.

They are there to tell the compiler you really want to input a ' " ' and

not
to terminate the string, so no point to keep them after the project is
built.

"Guadala Harry" <GM**@NoSpam.co m> ¦b¶l¥ó
news:Ow******** ******@TK2MSFTN GP09.phx.gbl ¤¤¼¶¼g...
I'd like to know the answer to the following question so I can know what
to
expect with regard to other similar uses of escape characters and strings. While everything works fine - I'd like to know specifically why:

I am building a simple HTML table in my C# code-behind by
concatenating strings that contain different parts of the table and table content...
something like this:

string myTable = "<table width=\"100%\" border=\"0\" cellspacing=\"0 \"
cellpadding=\"0 px\" class=\"myCSSCl ass\"><tr><td>" ;

Notice the back-slash (\) character which is there to escape each of the double-quote (") characters.

After the table is finished being constructed, it exists in one string
variable - which I HtmlEncode prior to returning to the caller.

The calling method then HtmlDecodes that string, and for testing purposes renders to the browser via Response.Write( ). The table renders just
beautifully. While that is good news, I'm curious as to what is happening
to
the \ escape characters. They are all present in the HtmlDecoded string, of
course - which is fed into Response.Write( ). The value of the string that shows up in the browser (i.e., the <table> definition) does *not* have the escape characters (at least as the browser shows the rendered page).
So, when were they removed, and what removed them?

In trying to determine where the escape characters are being removed

(client
or server side), I pasted the string value with the escape characters

(the value that is fed to Response.Write( )) directly into the ASPX file -
and it
failed to render correctly, as all of the escape characters were

present. So, apparently the browser is not removing them. What specifically is
removing them?

Thanks!



Nov 18 '05 #4

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

Similar topics

14
3522
by: Jon Maz | last post by:
Hi, I have been getting hopelessly confused with escaping escape characters in JScript! All I want to do is write a simple funtion: function DoubleUpBackSlash(inputString) { ??????? }
5
7956
by: KathyB | last post by:
Hi, not sure this is the right group, but hoping someone may have experienced this. I'm passing html text as a parameter to a javascript. When it has an apostrophe in it, of course it does parse correctly. BTW, using IE6 and msxml3/4. Even if I manually escape the ' with \' or '' the browser just sees it as \' or '' and not as an escaped...
2
5413
by: Don Clark | last post by:
Hello; Admittedly, I'm very new to HTML, and this is my first post to any newsgroup, so please go easy. I was looking at the html code for an email I received and noted an href statement that looked very unusual. The statement was: <a href=3D"http://www.%76%69t%2D%63%6F.com"> <INPUT TYPE=3D"submit" VALUE=3D"Order Here"...
4
7462
by: Guadala Harry | last post by:
I need to place the following into a string... How can I properly escape the % " / < and > characters? <table width="100%" border="0" cellspacing="0" cellpadding="4px" class="hfAll"></Table> Thanks.
7
4177
by: Axel Dahmen | last post by:
Hi, within a DataGrid control I'm using a DataTable containing a string column to fill a Hyperlink's href attribute. Unfortunately HttpUtility.UrlEncode() doesn't escape the apostroph character, thus ruining some of my hrefs. How do I correctly escape any character using a Page's current encoding (I don't want to hard-code the encoding)?...
15
18297
by: pkaeowic | last post by:
I am having a problem with the "escape" character \e. This code is in my Windows form KeyPress event. The compiler gives me "unrecognized escape sequence" even though this is documented in MSDN. Any idea if this is a bug? if (e.KeyChar == '\e') { this.Close(); }
131
9174
by: Lawrence D'Oliveiro | last post by:
The "escape" function in the "cgi" module escapes characters with special meanings in HTML. The ones that need escaping are '<', '&' and '"'. However, cgi.escape only escapes the quote character if you pass a second argument of True (the default is False): 'the "quick" &amp; &lt;brown&gt; fox' 'the &quot;quick&quot; &amp; &lt;brown&gt; fox' This seems to me to be...
10
2013
by: Chad | last post by:
Given: #include <stdio.h> #include <stdlib.h> #define MAXLINE 200 int main(void) { char buff;
1
4429
by: pronerd | last post by:
Hi, I was wondering if any one knows of an easy way to add escape characters to an existing string in a BASH script. I have a BASH script that is failing when a string is passed with brackets "" are passed to the sed command. I am trying to put together a BASH script to create Unix safe file names. i.e. Removes spaces, special...
0
7401
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...
1
7423
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...
0
7757
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5972
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5329
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4945
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...
0
3450
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1884
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
0
704
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...

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.