Subject: escape squences in C#
Posted By: kapi.goel Post Date: 1/6/2006 11:50:55 PM
Experts,

I am not able to use escape sequences in C#.

Example i am trying to say :-

string str = "hi i am in \"double quotes\". \n new line \t tabing";
Response.Write(str);

so result i am getting is:-
hi i am in "double quotes". new line tabing

so \n and \t sequence is not working, but \" is working fine.

Don't know what is the reason ?



KG
Reply By: Imar Reply Date: 1/7/2006 4:09:55 AM
Looking at the Response.Write, it appears you're using this in a web app.

I think that \n and \t ARE applied, but it's not visible on screen. If you look at the resulting HTML source in the browser,you'll see the source is formatted as expected. To have these characters appear on screen as well, use <br /> instead of \n.
\t (tab) can be solved in a different way; one is using multiple successive " " sequences.

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply By: planoie Reply Date: 1/8/2006 9:51:30 AM
Even multiple " " may not be sufficient.  You may need several "&nbsp;".  The browser usually ignores many " " in sequence and reduces them to a single " ".

-Peter
Reply By: Imar Reply Date: 1/8/2006 9:59:21 AM
I think I had that, but the &nbsp; was changed by the forum....

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.

Reply By: kapi.goel Reply Date: 1/9/2006 2:31:32 AM
quote:
Originally posted by Imar

Looking at the Response.Write, it appears you're using this in a web app.

I think that \n and \t ARE applied, but it's not visible on screen. If you look at the resulting HTML source in the browser,you'll see the source is formatted as expected. To have these characters appear on screen as well, use <br /> instead of \n.
\t (tab) can be solved in a different way; one is using multiple successive " " sequences.

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.




Imar, I used <br>  its working fine with IE.

But actually i am creating oen link, on click of that link opening outlook with all the email details. like cc, bcc, subject and body.

Problem is outlook is taking <br> as part of the string not as a new line. So i want to have a formatted email in the Outlook send page.

How can i do that ??

Tnx,


KG
Reply By: Imar Reply Date: 1/9/2006 12:22:39 PM
Does Outlook understand the \r\n construct?

The <br /> is used in the browser but apparently Outlook has trouble understanding that. If  \r\n doesn't work, I am not sure that what you want is possible...

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply By: kapi.goel Reply Date: 1/9/2006 11:21:14 PM
\r\n is not working....

KG
Reply By: Imar Reply Date: 1/10/2006 9:24:27 AM
Hi there,

Take a look at this ancient post I made in the past at p2p.wrox.com

It's over 5 years old, so it probably won't work anymore with more intelligent privacy aware mail applications like Outlook, but it's worth a try...

http://p2p.wrox.com/archive/html_code_clinic/2000-12/6.asp

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.

Go to topic 38532

Return to index page 399
Return to index page 398
Return to index page 397
Return to index page 396
Return to index page 395
Return to index page 394
Return to index page 393
Return to index page 392
Return to index page 391
Return to index page 390