Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Routes can use unicode characters without causing an encoding excepti…

…on on

Ruby 1.9.

Fixes #81.
  • Loading branch information...
commit 36132d6f7ca10dc5cf8ffb5b160404d304e72013 1 parent 280d931
@rkh rkh authored
Showing with 10 additions and 0 deletions.
  1. +1 −0  lib/sinatra/base.rb
  2. +9 −0 test/routing_test.rb
View
1  lib/sinatra/base.rb
@@ -545,6 +545,7 @@ def call!(env) # :nodoc:
@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
View
9 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' }
Please sign in to comment.
Something went wrong with that request. Please try again.