This project is archived and is in readonly mode.

#4680 ✓stale
stanislav

Rails 2.3.7 and Ruby 1.9: invalid byte sequence in US-ASCII

Reported by stanislav | May 24th, 2010 @ 04:21 PM | in 2.3.10

Hello,

I'm using Ruby 1.9.1-243 and after upgrade to Rails 2.3.7 I hit this error:
"invalid byte sequence in US-ASCII"

The problem is that in activesupport-2.3.7/lib/active_support/core_ext/object/blank.rb it is not checked for a valid_encoding in contrast with ActiveSupport-2.3.5 .

So in v2.3.7 we have this method:

def blank?
self !~ /\S/ end

... and it does not work with ruby 1.9

while the same method in v2.3.5 was this:

def blank?
(!self.respond_to(:valid_encoding?) or self.valid_encoding?) ? self !~ /\S/ : self.strip.size == 0 end

... and it worked :)

Any ideas how I can fix this?

Comments and changes to this ticket

  • Jeremy Kemper

    Jeremy Kemper May 24th, 2010 @ 07:15 PM

    • Milestone set to 2.3.8
    • State changed from “new” to “open”
    • Assigned user set to “Yehuda Katz (wycats)”

    Fix is forthcoming.

  • Jeremy Kemper

    Jeremy Kemper May 25th, 2010 @ 11:45 PM

    • Milestone changed from 2.3.8 to 2.3.9
  • Harm Aarts

    Harm Aarts June 15th, 2010 @ 06:11 PM

    I believe I have a related error in actionpack-2.3.8/lib/action_view/template_handlers/erb.rb. Line 14 uses a regex which dies when the encoding is not checked.

    Error occurs with Rails 2.3.8 and Ruby 1.9.1p378. Perhaps the more relevant question is how the encoding got messed up in the first place.

  • Harm Aarts

    Harm Aarts June 17th, 2010 @ 01:50 PM

    It appears that all regexes are affected, I get this error too when sending email:
    /gems/actionmailer-2.3.8/lib/action_mailer/utils.rb, line 4

  • Harm Aarts

    Harm Aarts June 17th, 2010 @ 02:43 PM

    FYI I think the upgrade from TMail 1.2.3 to 1.2.7 is responsible for the last error. The to_s method in Tmail (encoding.rb) looks iffy.

  • Jeremy Kemper

    Jeremy Kemper August 30th, 2010 @ 02:28 AM

    • Milestone changed from 2.3.9 to 2.3.10
    • Importance changed from “” to “Low”
  • Santiago Pastorino

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

    • Tag changed from rails 2.3.7, ruby 1.9, bug, encodings to rails 237, ruby 19, bug, encodings

    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:49 PM

    • State changed from “open” to “stale”
  • bingbing

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="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages