3

I just tweeted a link to this question What is the best C++ interview question? and the content had the two + signs (for C++) replaced with spaces. I edited it back to + signs, but I don't see why it should do that?

1

aha, correct, this was a bug

var url = 'http://twitter.com/share?url=' + encodeURIComponent(link) + 
          '&ref=twitbtn&text=' + encodeURIComponent(message);

versus

var url = 'http://twitter.com/share?url=' + encodeURIComponent(link) + 
          '&ref=twitbtn&text=' + escape(message);
1

The plus sign (+) just needs to be encoded before it's sent to Twitter.

So the part that's this:

What%20is%20the%20best%20C++%20interview%20question%3F

should ideally, if we're wanting to double-plus the face (which itself isn't on the question's URL), be this:

What%20is%20the%20best%20C%2B%2B%20interview%20question%3F

Twitter just interprets the plus signs as a space because that's the shorthand.

So it's and/or depending on if that plus sign will ever be encoded before being sent.

  • I'm not worried about the URL, but the actual content of the tweet. – Kate Gregory Dec 12 '10 at 23:37
  • The URL sent to Twitter (which creates the tweet content) is causing Twitter to interpret the ++ as spacespace @kat – random Dec 12 '10 at 23:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .