By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,705 Members | 1,301 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,705 IT Pros & Developers. It's quick & easy.

What Happens To Escape Characters?

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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> 在郵件
news:Ow**************@TK2MSFTNGP09.phx.gbl 中撰寫...
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

P: n/a
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> 在郵件
news:Ow**************@TK2MSFTNGP09.phx.gbl 中撰寫...
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

P: n/a
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> 在郵件
news:uB**************@TK2MSFTNGP09.phx.gbl 中撰寫...
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> 在郵件
news:Ow**************@TK2MSFTNGP09.phx.gbl 中撰寫...
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 discussion thread is closed

Replies have been disabled for this discussion.