Skip to content
This repository

utf8 in the urls #81

Closed
ahto opened this Issue · 2 comments

2 participants

Ahto Jussila Konstantin Haase
Ahto Jussila

Now that the params are forced to be utf8
http://github.com/sinatra/sinatra/commit/7289cd905c6b36b5c669fbbce1cc2bb00ddb0a39

Could it also be made possible for the url to be utf8.

Example when running ruby 1.9.2

# encoding: UTF-8

require 'sinatra'
get '/hellö' do
  'Hellö World!'
end

When loaded in browser results to

Encoding::CompatibilityError at /hell%C3%B6
incompatible encoding regexp match (UTF-8 regexp with ASCII-8BIT string)
file: base.rb
location: match
line: 554

But when I add force_encoding(@path) just before that line 554 it works.

Konstantin Haase
Owner
rkh commented

Yeah, there has been some discussion about how to handle this on the Rack mailinglist. Essentially it boils up to a GET /hellö not being the same as GET /hell%C3%B6. Let me do some more thinking about this. James Tucker (raggi) also said he'd do a write up about handling this topic and/or write a middleware for that. Will talk to him.

Konstantin Haase
Owner

Routes can use unicode characters without causing an encoding exception on
Ruby 1.9.

Closed by 2943e93.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.