Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 7th, 2006, 12:50 AM
Authorized User
 
Join Date: Dec 2005
Location: Bangalore, , .
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to kapi.goel
Default escape squences in C#

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
__________________
KG
Reply With Quote
  #2 (permalink)  
Old January 7th, 2006, 05:09 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

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 With Quote
  #3 (permalink)  
Old January 8th, 2006, 10:51 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

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 With Quote
  #4 (permalink)  
Old January 8th, 2006, 10:59 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

I think I had that, but the &nbsp; was changed by the forum....

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

Reply With Quote
  #5 (permalink)  
Old January 9th, 2006, 03:31 AM
Authorized User
 
Join Date: Dec 2005
Location: Bangalore, , .
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to kapi.goel
Default

Quote:
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 With Quote
  #6 (permalink)  
Old January 9th, 2006, 01:22 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

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 With Quote
  #7 (permalink)  
Old January 10th, 2006, 12:21 AM
Authorized User
 
Join Date: Dec 2005
Location: Bangalore, , .
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to kapi.goel
Default

\r\n is not working....

KG
Reply With Quote
  #8 (permalink)  
Old January 10th, 2006, 10:24 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

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_cod.../2000-12/6.asp

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Don't escape the whole thing with CDATA. akentanaka XSLT 2 December 4th, 2008 09:22 PM
Escape ' lafilip XSLT 3 May 22nd, 2007 03:31 AM
Forgotten escape character chrscote Classic ASP Basics 4 December 4th, 2006 09:37 AM
Escape char for '-' mattastic Access 1 October 6th, 2005 03:27 PM
Need Escape Character? shaileshmark SQL Server 2000 5 July 20th, 2004 12:35 PM



All times are GMT -4. The time now is 06:46 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.