1

I'm working on twitter client for win8, using RestSharp ( http://restsharp.org/ ) and I have such problem: When I'm posting new tweet with RestClient

var timeLine = new RestRequest("/1/statuses/update.json", Method.POST);
var txt = "Hello world";
timeLine.AddParameter("status", txt);

everything works excelent, but if I add more complex status like:

var txt = "Hello, World! What a nice day! #1May";
timeLine.AddParameter("status", txt);

I recieve 401 error. In debugger I saw, that status parameter in Signature Base String is incorrect. I have:

status%3DHello%2C%2520World%21%2520What%2520a%2520nice%2520day%21%2520%231May

and right string (from dev.twitter.com):

status%3DHello%252C%2520World%2521%2520What%2520a%2520nice%2520day%2521%2520%25231May

You can see, that punctuation marks ,!# and other encodes incorrect. How can I fix it? Signature base generation and Encoding are in /Authenticators/OAuth/OAuthTools.cs

Ponf
  • 1,190
  • 1
  • 12
  • 28
  • can you file a bug on https://github.com/restsharp/restsharp/issues and mention it in the google group http://groups.google.com/group/restsharp to see if someone can pick it up to fix? or a pull request works too. – John Sheehan May 02 '12 at 20:50

1 Answers1

0

I have the same problem when I display twitter feed in website. Hence, I used this code to convert the text.

Regex.Replace(str, "@(.*?):", @"@http://twitter.com/#!/$1>$1:");

OrganicCoder
  • 107
  • 1
  • 4