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.

I18n interpolation fails with multibyte strings on Ruby 1.9

#2038

Current Rails I18n.interpolate fails with the following error when multibyte values given on Ruby 1.9.


incompatible character encodings: UTF-8 and ASCII-8BIT

This patch removes unnecessary force_encoding (which basically is not recommended to use), and enables interpolations between multibyte string and values. On the other hand, this patch stops caring about interpolations between two different multibyte encodings. (but who needs it?) Please look at the attached test cases for details.

Reported by Akira Matsuda · February 22nd, 2009 @ 12:56 AM

State: committed
Milestone: none
Assigned to: Sven Fuchs Sven Fuchs
Importance: High

Activity

  1. DHH
    DHH
    • Assigned user set to Sven Fuchs

    February 22nd, 2009 @ 03:15 PM

  2. Manfred Stienstra
    Manfred Stienstra

    The tests didn't run on Ruby 1.8 because Encoding isn't defined. Attached is a patch with running tests on both 1.8 and 1.9.

    February 27th, 2009 @ 03:02 PM

  3. Sven Fuchs
    Sven Fuchs

    Awesome. Thanks Manfred!

    I've applied that patch to the I18n gem and bumped its version to 0.1.3

    Attached is a patch that vendorizes that gem version to Rails.

    PS: Unfortunately I'm not aware how to do it so that the Rails history gives proper credits to Akira :( The I18n history now does. Is there any way how I could keep Akira's original authorship?

    February 27th, 2009 @ 03:49 PM

  4. Sven Fuchs
  5. Manfred Stienstra
    Manfred Stienstra

    Nope, you can either credit your entire patch to Akira or not at all. Unfortunately Git doesn't allow you to set multiple authors for a commit. I assume they think commits should be small enough to be made by one author.

    February 27th, 2009 @ 04:11 PM

  6. Repository
    Repository
    • State changed from new to committed

    (from [943d64b1c857944666bff2572857abe866615274]) Vendorize i18n 0.1.3 gem (fixes issues with incompatible character encodings in Ruby 1.9) (Akira Matsuda) [#2038 I18n interpolation fails with multibyte strings on Ruby 1.9 state:committed]

    Signed-off-by: David Heinemeier Hansson david@loudthinking.com http://github.com/rails/rails/co...

    February 27th, 2009 @ 04:15 PM

  7. Jeremy Kemper
  8. Akira Matsuda
    Akira Matsuda

    Ah, sorry for the tests on Ruby 1.8.
    Thank you for fixing that, Manfred.
    And, thanks for the credit, Sven.

    February 28th, 2009 @ 04:43 AM