This project is archived and is in readonly mode.

#5713 open

Ruby 1.9 -Ku incompatible with mem_cache_store

Reported by andreas | September 27th, 2010 @ 11:06 AM

When Ruby 1.9 is started in unicode mode (-Ku), mem_cache_store.rb fails to parse:

/usr/local/ruby19/bin/ruby -Ku /usr/local/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/cache/mem_cache_store.rb
/usr/local/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/cache/mem_cache_store.rb:32: invalid multibyte escape: /[\x00-\x20%\x7F-\xFF]/

Comments and changes to this ticket

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:59 PM

    • State changed from “new” to “open”
    • Tag changed from 3.0, activesupport to 30, activesupport

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:59 PM

    • State changed from “open” to “stale”
  • Nick Wilson

    Nick Wilson February 7th, 2011 @ 08:16 AM

    • State changed from “stale” to “open”


    This is still a known issue with ruby 1.9.2 and Rails/ActiveSupport 3.0.3

    Ruby 1.9 in unicode mode will attempt to interpret the regular expression as unicode. To avoid this you need to pass the regular expression option "n" for "no encoding":

    = /[\x00-\x20%\x7F-\xFF]/

    = /[\x00-\x20%\x7F-\xFF]/n

    Now we have our raw 8-bit encoding (the only thing Ruby 1.8 speaks) as intended:
    ruby-1.9.2-p136 :001 > ESCAPE_KEY_CHARS = /[\x00-\x20%\x7F-\xFF]/n.encoding
    => # <Encoding:ASCII-8BIT>

Create your profile

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

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket