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

ht insert one double quote?

P: n/a
I am writing an app that enables a user to reply to a newsgroup.

The proper syntax for From: is

"screen name" em***@address.com

and over all, it should look like:

--

From: "screen name" em***@address.com
Subject: mySubject
Date: Tuesday, September 25, 2007 8:51 AM

body goes here . . . .

--

Problems #1: in this app, ScreenName is a variable that does not have
either beginning or ending double quotes. How do I insert/append the
beginning and ending double quotes?

Problem#2: how do I insert/append a line feed in the text feed to the
server so that the text does not have \n\r in it?

Right now, the best I can do using StringBuilder's Append and AppendFormat
is:

--

From: screen name em***@address.com\n\rSubject: mySubject\n\rDate: Tuesday,
September 25, 2007 8:51 AM\n\r\n\rbody goes here . . . .

--
Thank you
Sep 25 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
xzzy,

You can just use escaped quotes, like so:

string quoted = "\"" + screenName + "\"";

As for appending a line feed to send to the server, and you use \r\n
without the "@" before your string, then a line feed/new line combo will be
sent to the server, not the literal string "\r\n".
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"xzzy" <mr********@comcast.netwrote in message
news:V5******************************@comcast.com. ..
>I am writing an app that enables a user to reply to a newsgroup.

The proper syntax for From: is

"screen name" em***@address.com

and over all, it should look like:

--

From: "screen name" em***@address.com
Subject: mySubject
Date: Tuesday, September 25, 2007 8:51 AM

body goes here . . . .

--

Problems #1: in this app, ScreenName is a variable that does not have
either beginning or ending double quotes. How do I insert/append the
beginning and ending double quotes?

Problem#2: how do I insert/append a line feed in the text feed to the
server so that the text does not have \n\r in it?

Right now, the best I can do using StringBuilder's Append and AppendFormat
is:

--

From: screen name em***@address.com\n\rSubject: mySubject\n\rDate:
Tuesday, September 25, 2007 8:51 AM\n\r\n\rbody goes here . . . .

--
Thank you

Sep 25 '07 #2

P: n/a
Nicholas, thank you for your time and effort with this problem.

When I do:
StringBuilder sb = new StringBuilder();

string xname = "\"" + yScreenName + "\"";

sb.Append(xname + " ");

sb.Append("<");

sb.Append(yUID);

sb.Append(">");

the result is:

"\"xzzy\" <na**@provider.net>"

I can connect the news server and the news group and download posts, but
when trying to post to the NG, this error message occurs:

Unable to read data from the transport connection.

which I have searched and found to mean that the "From:" address is not
being accepted

I am currently "stumped" and dead in the water on this.

I thank you for any help you can provide.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:OC**************@TK2MSFTNGP06.phx.gbl...
xzzy,

You can just use escaped quotes, like so:

string quoted = "\"" + screenName + "\"";

As for appending a line feed to send to the server, and you use \r\n
without the "@" before your string, then a line feed/new line combo will
be sent to the server, not the literal string "\r\n".
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"xzzy" <mr********@comcast.netwrote in message
news:V5******************************@comcast.com. ..
>>I am writing an app that enables a user to reply to a newsgroup.

The proper syntax for From: is

"screen name" em***@address.com

and over all, it should look like:

--

From: "screen name" em***@address.com
Subject: mySubject
Date: Tuesday, September 25, 2007 8:51 AM

body goes here . . . .

--

Problems #1: in this app, ScreenName is a variable that does not have
either beginning or ending double quotes. How do I insert/append the
beginning and ending double quotes?

Problem#2: how do I insert/append a line feed in the text feed to the
server so that the text does not have \n\r in it?

Right now, the best I can do using StringBuilder's Append and
AppendFormat is:

--

From: screen name em***@address.com\n\rSubject: mySubject\n\rDate:
Tuesday, September 25, 2007 8:51 AM\n\r\n\rbody goes here . . . .

--
Thank you


Sep 26 '07 #3

P: n/a
xzzy,

Where are you looking at the result from, in the debugger? If so, then
the debugger is going to show you the string with the escape characters, but
that is not the literal string in memory. Did you use the text debugger
visualizer? It will show you the quotes in memory.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"xzzy" <mr********@comcast.netwrote in message
news:Ia******************************@comcast.com. ..
Nicholas, thank you for your time and effort with this problem.

When I do:
StringBuilder sb = new StringBuilder();

string xname = "\"" + yScreenName + "\"";

sb.Append(xname + " ");

sb.Append("<");

sb.Append(yUID);

sb.Append(">");

the result is:

"\"xzzy\" <na**@provider.net>"

I can connect the news server and the news group and download posts, but
when trying to post to the NG, this error message occurs:

Unable to read data from the transport connection.

which I have searched and found to mean that the "From:" address is not
being accepted

I am currently "stumped" and dead in the water on this.

I thank you for any help you can provide.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote
in message news:OC**************@TK2MSFTNGP06.phx.gbl...
>xzzy,

You can just use escaped quotes, like so:

string quoted = "\"" + screenName + "\"";

As for appending a line feed to send to the server, and you use \r\n
without the "@" before your string, then a line feed/new line combo will
be sent to the server, not the literal string "\r\n".
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"xzzy" <mr********@comcast.netwrote in message
news:V5******************************@comcast.com ...
>>>I am writing an app that enables a user to reply to a newsgroup.

The proper syntax for From: is

"screen name" em***@address.com

and over all, it should look like:

--

From: "screen name" em***@address.com
Subject: mySubject
Date: Tuesday, September 25, 2007 8:51 AM

body goes here . . . .

--

Problems #1: in this app, ScreenName is a variable that does not have
either beginning or ending double quotes. How do I insert/append the
beginning and ending double quotes?

Problem#2: how do I insert/append a line feed in the text feed to the
server so that the text does not have \n\r in it?

Right now, the best I can do using StringBuilder's Append and
AppendFormat is:

--

From: screen name em***@address.com\n\rSubject: mySubject\n\rDate:
Tuesday, September 25, 2007 8:51 AM\n\r\n\rbody goes here . . . .

--
Thank you



Sep 26 '07 #4

P: n/a

"xzzy" <mr********@comcast.netwrote in message
news:Ia******************************@comcast.com. ..
Nicholas, thank you for your time and effort with this problem.

When I do:
StringBuilder sb = new StringBuilder();

string xname = "\"" + yScreenName + "\"";

sb.Append(xname + " ");

sb.Append("<");

sb.Append(yUID);

sb.Append(">");

the result is:

"\"xzzy\" <na**@provider.net>"

I can connect the news server and the news group and download posts, but
when trying to post to the NG, this error message occurs:

Unable to read data from the transport connection.

which I have searched and found to mean that the "From:" address is not
being accepted
I really doubt the error message you mention means that. It sounds as if
the connection was dropped, which could be a network error or could be
intentionally done by the other end.

The other end might intentionally drop the connection if your data was in
the correct format, but matched a blacklist (or didn't match a whitelist).
Badly formatted data would be more likely to give an error message.

I'm speaking from my knowledge of SMTP and HTTP, and I presume NNTP would
work very similarly.
>
I am currently "stumped" and dead in the water on this.

I thank you for any help you can provide.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote
in message news:OC**************@TK2MSFTNGP06.phx.gbl...
>xzzy,

You can just use escaped quotes, like so:

string quoted = "\"" + screenName + "\"";

As for appending a line feed to send to the server, and you use \r\n
without the "@" before your string, then a line feed/new line combo will
be sent to the server, not the literal string "\r\n".
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"xzzy" <mr********@comcast.netwrote in message
news:V5******************************@comcast.com ...
>>>I am writing an app that enables a user to reply to a newsgroup.

The proper syntax for From: is

"screen name" em***@address.com

and over all, it should look like:

--

From: "screen name" em***@address.com
Subject: mySubject
Date: Tuesday, September 25, 2007 8:51 AM

body goes here . . . .

--

Problems #1: in this app, ScreenName is a variable that does not have
either beginning or ending double quotes. How do I insert/append the
beginning and ending double quotes?

Problem#2: how do I insert/append a line feed in the text feed to the
server so that the text does not have \n\r in it?

Right now, the best I can do using StringBuilder's Append and
AppendFormat is:

--

From: screen name em***@address.com\n\rSubject: mySubject\n\rDate:
Tuesday, September 25, 2007 8:51 AM\n\r\n\rbody goes here . . . .

--
Thank you



Sep 26 '07 #5

P: n/a
Nicholas thank you for your help with getting the string properly formatted.

Ben, I think your comment about the ISP deliberately dropping the connection
may be an issue
..
The app I am writing enables a user to have one stop shopping for
information, regardless of the information's type or location, and it
automatically organizes the information into user defined "Topics".
Probably testing the app upset the newsgroup provider as I have never had a
problem with any other newserver, email server provider, provider of
pictures, files, media, . . .

This particular newsgroup provider is about 4 miles from here, guess I'll
have to wear a suit for a couple hours.
Thank you,

John Bickmore

"Ben Voigt [C++ MVP]" <rb*@nospam.nospamwrote in message
news:eP**************@TK2MSFTNGP02.phx.gbl...
>
"xzzy" <mr********@comcast.netwrote in message
news:Ia******************************@comcast.com. ..
>Nicholas, thank you for your time and effort with this problem.

When I do:
StringBuilder sb = new StringBuilder();

string xname = "\"" + yScreenName + "\"";

sb.Append(xname + " ");

sb.Append("<");

sb.Append(yUID);

sb.Append(">");

the result is:

"\"xzzy\" <na**@provider.net>"

I can connect the news server and the news group and download posts, but
when trying to post to the NG, this error message occurs:

Unable to read data from the transport connection.

which I have searched and found to mean that the "From:" address is not
being accepted

I really doubt the error message you mention means that. It sounds as if
the connection was dropped, which could be a network error or could be
intentionally done by the other end.

The other end might intentionally drop the connection if your data was in
the correct format, but matched a blacklist (or didn't match a whitelist).
Badly formatted data would be more likely to give an error message.

I'm speaking from my knowledge of SMTP and HTTP, and I presume NNTP would
work very similarly.
>>
I am currently "stumped" and dead in the water on this.

I thank you for any help you can provide.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote
in message news:OC**************@TK2MSFTNGP06.phx.gbl...
>>xzzy,

You can just use escaped quotes, like so:

string quoted = "\"" + screenName + "\"";

As for appending a line feed to send to the server, and you use \r\n
without the "@" before your string, then a line feed/new line combo will
be sent to the server, not the literal string "\r\n".
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"xzzy" <mr********@comcast.netwrote in message
news:V5******************************@comcast.co m...
I am writing an app that enables a user to reply to a newsgroup.

The proper syntax for From: is

"screen name" em***@address.com

and over all, it should look like:

--

From: "screen name" em***@address.com
Subject: mySubject
Date: Tuesday, September 25, 2007 8:51 AM

body goes here . . . .

--

Problems #1: in this app, ScreenName is a variable that does not have
either beginning or ending double quotes. How do I insert/append the
beginning and ending double quotes?

Problem#2: how do I insert/append a line feed in the text feed to the
server so that the text does not have \n\r in it?

Right now, the best I can do using StringBuilder's Append and
AppendFormat is:

--

From: screen name em***@address.com\n\rSubject: mySubject\n\rDate:
Tuesday, September 25, 2007 8:51 AM\n\r\n\rbody goes here . . . .

--
Thank you



Sep 26 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.