Browsing articles from "December, 2010"

New Twitter no longer accepts url encoding spaces as +

Dec 2, 2010   //   by Mal Curtis   //   Blog, Code, PHP, Technology, Twitter  //  No Comments

At the end of every SitePoint Course lesson there’s a link to shout out to Twitter that you’ve completed that days lesson. We try and mix these up as much as possible, from the original “Woohoo! I just finished day 1…” to the more obscure “Bickity Bam!” and “Holy Guacamole”.

Most recently we’ve noticed a few tweets in the form “Bickity+Bam!+I+just+completed+lesson+7+of+SitePoint’s+CSS3+Live+course+#css3live”, and on investigation it looks like once New Twitter was rolled out, Twitter no longer accepted the more common method of encoding spaces as a + sign, and only accepts the strict RFC 3986 specification of %20.

If you’re a PHP user, this simple means swapping from urlencode() to rawurlencode().

$url = urlencode("http://twitter.com/?status=What are these plus signs?"); // Bad
$url = rawurlencode("http://twitter.com/?status=No plus signs here mofo'"); // Good

Done.

Update This is actually more likely to be part of their security upgrades after the url injection issues they were having