#88 ✓resolved
Nate Wiger

Safari-specific hack in rack/request.rb breaks UTF-8 POSTs

Reported by Nate Wiger | December 30th, 2009 @ 10:50 PM

There's a Safari-specific hack in Rack currently, specifically line 149 of rack/request.rb:

      # Fix for Safari Ajax postings that always append \0
      form_vars.sub!(/\0\z/, '')

Unfortunately, if the client is sending UTF-8 this explodes with a FAILSAFE error:

    invalid byte sequence in US-ASCII

This is similar to another UTF-8 bug I filed before on Rack: http://rack.lighthouseapp.com/projects/22435/tickets/46-rack-in-rub...

The fix for that was to use a UTF-8 aware handling method: http://github.com/rack/rack/commit/9abab4a36b10a0ce3f667ef1099e3361...

It seems like Ruby 1.9's string encoding detection could be useful to fix this: http://blog.grayproductions.net/articles/ruby_19s_string

I will make an attempt at a patch (in the meantime we are just commenting out that line), but since this breaks UTF-8 in a pretty severe way, probably a core Rack contributor should take a quick glance too.

Thanks,
Nate

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Pages