ht insert one double quote?

X

xzzy

I am writing an app that enables a user to reply to a newsgroup.

The proper syntax for From: is

"screen name" (e-mail address removed)

and over all, it should look like:

--

From: "screen name" (e-mail address removed)
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:
 
N

Nicholas Paldino [.NET/C# MVP]

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".
 
X

xzzy

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\" <[email protected]>"

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 said:
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]
- (e-mail address removed)

xzzy said:
I am writing an app that enables a user to reply to a newsgroup.

The proper syntax for From: is

"screen name" (e-mail address removed)

and over all, it should look like:

--

From: "screen name" (e-mail address removed)
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:
 
N

Nicholas Paldino [.NET/C# MVP]

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]
- (e-mail address removed)

xzzy said:
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\" <[email protected]>"

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 said:
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]
- (e-mail address removed)

xzzy said:
I am writing an app that enables a user to reply to a newsgroup.

The proper syntax for From: is

"screen name" (e-mail address removed)

and over all, it should look like:

--

From: "screen name" (e-mail address removed)
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:
 
B

Ben Voigt [C++ MVP]

xzzy said:
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\" <[email protected]>"

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 said:
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]
- (e-mail address removed)

xzzy said:
I am writing an app that enables a user to reply to a newsgroup.

The proper syntax for From: is

"screen name" (e-mail address removed)

and over all, it should look like:

--

From: "screen name" (e-mail address removed)
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:
 
X

xzzy

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 said:
xzzy said:
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\" <[email protected]>"

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 said:
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]
- (e-mail address removed)

I am writing an app that enables a user to reply to a newsgroup.

The proper syntax for From: is

"screen name" (e-mail address removed)

and over all, it should look like:

--

From: "screen name" (e-mail address removed)
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:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top