utf8 urls behave differently on jruby 1.7.8 and ruby 2.0.0 #820

Closed
ahto opened this Issue Nov 29, 2013 · 4 comments

Comments

Projects
None yet
3 participants
@ahto

ahto commented Nov 29, 2013

Example

# encoding: UTF-8

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

With 2.0.0

$ ruby example.rb 
[2013-11-29 11:53:25] INFO  WEBrick 1.3.1
[2013-11-29 11:53:25] INFO  ruby 2.0.0 (2013-11-22) [x86_64-linux]
== Sinatra/1.4.4 has taken the stage on 4567 for development with backup from WEBrick
[2013-11-29 11:53:25] INFO  WEBrick::HTTPServer#start: pid=18955 port=4567
127.0.0.1 - - [29/Nov/2013 11:53:29] "GET /hell%C3%B6 HTTP/1.1" 200 13 0.0032
localhost - - [29/Nov/2013:11:53:29 EET] "GET /hell%C3%B6 HTTP/1.1" 200 13
- -> /hell%C3%B6

With JRuby 1.7.8

$ ruby example.rb 
NameError: undefined method `GET /hellö' for class `Sinatra::Application'
  instance_method at org/jruby/RubyModule.java:2016
  generate_method at /home/zizzler/.rvm/gems/jruby-1.7.8@sinatra_utf8/gems/sinatra-1.4.4/lib/sinatra/base.rb:1579
         compile! at /home/zizzler/.rvm/gems/jruby-1.7.8@sinatra_utf8/gems/sinatra-1.4.4/lib/sinatra/base.rb:1587
            route at /home/zizzler/.rvm/gems/jruby-1.7.8@sinatra_utf8/gems/sinatra-1.4.4/lib/sinatra/base.rb:1567
              get at /home/zizzler/.rvm/gems/jruby-1.7.8@sinatra_utf8/gems/sinatra-1.4.4/lib/sinatra/base.rb:1353
              get at /home/zizzler/.rvm/gems/jruby-1.7.8@sinatra_utf8/gems/sinatra-1.4.4/lib/sinatra/base.rb:1972
           (root) at example.rb:4

Example with workaround. Works in both

# encoding: UTF-8

require 'sinatra'
require  'cgi'
get "/#{CGI::escape('hellö')}" do
  'Hellö World!'
end

Possibly related:
#81

@rkh

This comment has been minimized.

Show comment Hide comment
@rkh

rkh Nov 29, 2013

Owner

This is very strange. It's working on MRI 1.9.3, right?

Owner

rkh commented Nov 29, 2013

This is very strange. It's working on MRI 1.9.3, right?

@ahto

This comment has been minimized.

Show comment Hide comment
@ahto

ahto Nov 29, 2013

yes works in 1.9.3 too.

ahto commented Nov 29, 2013

yes works in 1.9.3 too.

@namusyaka

This comment has been minimized.

Show comment Hide comment
@namusyaka

namusyaka Apr 8, 2014

Member

@rkh This should be fixed in #824.

Member

namusyaka commented Apr 8, 2014

@rkh This should be fixed in #824.

@rkh rkh closed this Apr 8, 2014

@rkh

This comment has been minimized.

Show comment Hide comment
@rkh

rkh Apr 8, 2014

Owner

Thanks!

Owner

rkh commented Apr 8, 2014

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment