diff --git a/lib/sinatra/base.rb b/lib/sinatra/base.rb index 5a4f3d88..69b4a54f 100644 --- a/lib/sinatra/base.rb +++ b/lib/sinatra/base.rb @@ -550,6 +550,7 @@ module Sinatra @response = Response.new @params = indifferent_params(@request.params) template_cache.clear if settings.reload_templates + force_encoding(@request.route) force_encoding(@params) @response['Content-Type'] = nil diff --git a/test/routing_test.rb b/test/routing_test.rb index 85961a55..f15765a0 100644 --- a/test/routing_test.rb +++ b/test/routing_test.rb @@ -1,3 +1,4 @@ +# I like coding: UTF-8 require File.dirname(__FILE__) + '/helper' # Helper method for easy route pattern matching testing @@ -69,6 +70,14 @@ class RoutingTest < Test::Unit::TestCase assert_equal 'pass', response.headers['X-Cascade'] end + it "allows using unicode" do + mock_app do + get('/föö') { } + end + get '/f%C3%B6%C3%B6' + assert_equal 200, status + end + it "overrides the content-type in error handlers" do mock_app { before { content_type 'text/plain' }