472,804 Members | 980 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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=\"0px\" class=\"myCSSClass\"><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 2168
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.com> ¦b¶l¥ó
news:Ow**************@TK2MSFTNGP09.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=\"0px\" class=\"myCSSClass\"><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.com.hk> wrote in message
news:%2****************@TK2MSFTNGP11.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.com> ¦b¶l¥ó
news:Ow**************@TK2MSFTNGP09.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=\"0px\" class=\"myCSSClass\"><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.com> ¦b¶l¥ó
news:uB**************@TK2MSFTNGP09.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.com.hk> wrote in message
news:%2****************@TK2MSFTNGP11.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.com> ¦b¶l¥ó
news:Ow**************@TK2MSFTNGP09.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=\"0px\" class=\"myCSSClass\"><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
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
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...
2
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...
4
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> ...
7
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,...
15
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....
131
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...
10
by: Chad | last post by:
Given: #include <stdio.h> #include <stdlib.h> #define MAXLINE 200 int main(void) { char buff;
1
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...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.