Joe Letizia

This is where I write my simple ramblings on martial arts, software, life, and other nonsense.

Parameterize - URLs Don't Like to be Slashed

23 Apr 2013

I was recently working on a side project to create an RSS reader in Rails. Well, to be honest, it was more of a javascript application that simply consumed data from a rails service. You can checkout the project here.

One thing I had to do was send a unique identifier to the front end to identify the article to read. To do this, I encoded the URL text in base64. I thought this would work great...until I realized that the '/' character is in the base64 character set...shit.

But fear not...rails has a nice little function in ActiveSupport called parameterize that will format a string into a URL-safe string.

Checkout the gist