Sinatra utf-8 Content-Type before filter April 22, 2009Posted by John Dewey in Code, Example, Sinatra.
I wanted to learn Sinatra, so I started converting my personal Rails site over to Sinatra. I scrape my Twitterholic rating, and redisplay it on my site. I need the css and html to have a Content-Type of utf-8.
I came up with the following before filter. There is probably a better way to do this, I just wanted my controllers to be less “wet”.
I also use the following to render all css.