-1

I developed a small application to post tweets using C#. I followed the below guide and everything works like a charm:

http://www.overpie.com/aspnet/articles/csharp-post-message-to-twitter

The only problem is that if I try to tweet something having the single quote character('), I get a 401 error. I tried escaping it using all the below, but I either ended up with the same error or the characters.

/'
//'
'''
''''
HtmlEncode

Any help please? For the record I get the same problem if I tweet with an exclamation mark.

WPRookie82
  • 165
  • 9
  • You need to build Url with classes designed for it like `UriBuilder` and `HttpUtility` (see [Build query string](http://stackoverflow.com/questions/829080/how-to-build-a-query-string-for-a-url-in-c) ) for example. Unfortunately you did not provide code that you have, so it is very hard to help you fix it. – Alexei Levenkov Oct 01 '14 at 18:44
  • Hi Alexei - the code is exactly as per the URL I linked to. – WPRookie82 Oct 02 '14 at 06:47
  • With UrlEncode, result in Twitter is: Single%27s+Quote – WPRookie82 Oct 02 '14 at 07:14
  • For post to be valid SO question it needs to contain *all* related information in the post (source, problem description, what you tried and how it failed). Links to source are ok as supplement. – Alexei Levenkov Oct 02 '14 at 14:10
  • `Single%27s+Quote` looks like valid query parameter to me. It is generally good idea to update you question with information you have instead/in addition to comments so it is clear what part of the problem is still a problem and what other people should finally post as "answer". – Alexei Levenkov Oct 02 '14 at 14:13

1 Answers1

0

Can you try escaping through HTML encoding.

For single quote use '
Arun Ghosh
  • 7,634
  • 1
  • 26
  • 38