Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

ActiveSupport::Gzip.compress returns invalid UTF-8 strings

#6386

ActiveSuport::Gzip.compress returns strings encoded as UTF-8:

    ruby-1.9.2-p136 :001 > ActiveSupport::Gzip.compress('').encoding
     => #<Encoding:UTF-8>

But they aren't actually UTF-8 strings:

    ruby-1.9.2-p136 :002 > ActiveSupport::Gzip.compress('').blank?
    ArgumentError: invalid byte sequence in UTF-8

Should the encoding be forced to ASCII-8BIT?

Reported by David Phillips · February 8th, 2011 @ 01:25 AM

State: resolved
Milestone: none
Assigned to: Santiago Pastorino Santiago Pastorino
Importance: none

Activity

  1. Josh Kalderimis
    Josh Kalderimis
    • Tag set to active_support
    • Assigned user set to Santiago Pastorino

    Hi David,

    I have wrapped up your example into a failing test case and have whipped up a patch to correct the problem. I just need to run it by Santiago before I pop the diff up, which I'll do tomorrow morning.

    Thanks,

    Josh

    February 9th, 2011 @ 12:07 AM

  2. Repository
    Repository
    • State changed from new to resolved

    (from [3eb25fb8806c0b161d2d1d9cb22d0bdfc7b0ce63]) fix for AS Gzip returning a UTF-8 string in Ruby 1.9 when it is actually binary [#6386 ActiveSupport::Gzip.compress returns invalid UTF-8 strings state:resolved]

    Signed-off-by: José Valim jose.valim@gmail.com
    https://github.com/rails/rails/commit/3eb25fb8806c0b161d2d1d9cb22d0...

    February 9th, 2011 @ 09:27 AM

  3. Repository
  4. David Phillips