Twitter Hashtags and QR Codes

by @edent | # # # # # | 7 comments | Read ~2,783 times.

I spotted this poster today, encouraging people to search for the Twitter hashtag “#Transformers”.
Transformers Poster Twitter Hashtag

Wouldn’t it make sense to use a QR code as well? That way people could quickly scan, and be taken straight to the discussion, rather than have to fire up Twitter and do a manual search.

As it happens, it’s slightly tricky to make a QR code which searches for a Twitter hashtag.

There are two things to note:

  1. Twitter’s search URLs are annoyingly different from every other search URL on the planet.
  2. You will need to take care of URL Encoding for special characters.

Building The Search Query

A typical Twitter search URL is!/search/

With the query at the end, so a search for “Transformers” would be!/search/Transformers

Encoding Correctly

Hash symbols (#) need to be URL Encoded. In this case, the hash becomes “%23”!/search/%23Transformers

However, there is a “gotcha”. Because of the… special… way Twitter constructs its search URLs, we have to URL Encode the percentage sign! So, the “%” becomes “%25”.

So, our final URL becomes!/search/%2523Transformers

Finally, if you want to use something like Google Charts to create your QR codes, you’ll need the URL Encode all of the : / # ! and other special characters.

The Final Result

We end up with a QR code which can be scanned to take the user directly to the hashtag they are searching for,Transformers Hashtag Twitter Search

7 thoughts on “Twitter Hashtags and QR Codes

  1. Why not drop the mobile bit, twitter will redirect to the most appropriate version for the device.
    Also you can use saving an character.

  2. Sadly, that doesn’t work. Using ?q= gets redirected, but the search parameter is stripped off in the redirect.

  3. (in case it strips out has % 25 %23) worked fine.

    1. Interesting. It doesn’t work for me. I wonder if it’s because I’m signed in – or because I’ve got the new HTML5 experience?

  4. Maybe they thought about it and hit the same stumbling blocks as you. Your QR code URL doesn’t work for me, leads me to the mobile twitter home screen.

    1. Mine or Ryan’s?

      If you can’t use mine, and I can’t use his, it looks like there’s something seriously weird with how Twitter handles mobile searches and redirects.

Leave a Reply

Your email address will not be published. Required fields are marked *