Home >  Archive >  2011 >  April >  10

Previous / Next

Encoding trouble with Twitter's OAuth
By Dave Winer on Sunday, April 10, 2011 at 9:13 PM.

A picture named russo.jpgA couple of weekend's ago I threw in the towel and wrote my own mini-version of TwitterFeed that would work for users of my minimal blogging tool. I've released the code as an OPML Editor tool, so at least in theory it could be installed by others. That's the plan, eventually, that it will be running on lots of servers, so as to spread out the load. TwitterFeed, while it's a marvelous public service, suffers from being centralized, in many of the same ways Twitter itself does. #

Anyway, I've mostly got it working. However it fails to post some messages. Twitter says they have an incorrect signature. Here are a few of the tweets. #

Coming soon: A Twitter camera. (Scripting News). http://r2.ly/a9rk #

string.urlencode ("Coming soon: A Twitter camera. (Scripting News). http://r2.ly/a9rk", true) #

"Coming%20soon%3A%20A%20Twitter%20camera.%20%28Scripting%20News%29.%20%20http%3A%2F%2Fr2.ly%2Fa9rk" #

'The Suburbs of Manhattan' - Living in the West 70s. http://r2.ly/a9rh #

string.urlencode ("'The Suburbs of Manhattan' - Living in the West 70s. http://r2.ly/a9rh", true) #

"%27The%20Suburbs%20of%20Manhattan%27%20-%20Living%20in%20the%20West%2070s.%20%20http%3A%2F%2Fr2.ly%2Fa9rh" #

Quote For The Day II (from Andrew Sullivan's new home at TDB). http://r2.ly/a9qm #

string.urlencode ("Quote For The Day II (from Andrew Sullivan's new home at TDB). http://r2.ly/a9qm", true) #

"Quote%20For%20The%20Day%20II%20%28from%20Andrew%20Sullivan%27s%20new%20home%20at%20TDB%29.%20%20http%3A%2F%2Fr2.ly%2Fa9qm" #

What do they have in common? Punctuation.  #

But here's the thing -- it looks like Twitter's encoding and mine agree. They echo back the parameters. Not sure if it's their version they're echoing or mine (hence the confusion).  #

Wondering if any of you guys have been down this path and can offer some suggestions? #

I looked for a Twitter OAuth debugger. Maybe there is one... #

Help much appreciated. #

Update: Solved with the help of Simon Jenson. I was not encoding left and right parens or single quotes. The OAuth spec is pretty clear. Thanks! #

Update #2: Here's a table of the encodings for each of the characters generated by string.urlEncode, a built-in verb in OPML Editor that I've been updating to make this encoding work.  #




Christmas Tree
This site contributes to the scripting.com community river.


© Copyright 1997-2011 Dave Winer. Last update: Monday, April 11, 2011 at 10:07 AM Eastern. Last build: 12/12/2011; 1:01:35 PM. "It's even worse than it appears."

RSS feed for Scripting News

Previous / Next