I18n handling of Rails 3.0 differs between 1.9 and 1.8 compatibility mode
-------------------------------------------------------------------------

                 Key: JRUBY-5735
                 URL: http://jira.codehaus.org/browse/JRUBY-5735
             Project: JRuby
          Issue Type: Bug
          Components: Rails WAR Deployment, Ruby 1.9.2
    Affects Versions: JRuby 1.6.1
            Reporter: Clemens Fuchslocher
         Attachments: i18n_test.stacktrace, i18n_test.tar.gz

The attached testcase [^i18n_test.tar.gz] contains a simple Rails 3.0 
application with a single controller and view. The view 
app/views/i18n_test/i18n_test.html.erb uses the I18n module for translation. 
The locale file config/locales/en.yml is UTF-8 encoded and contains some German 
umlauts. The file doesn't have a BOM.

With compatibility mode 1.8 everything is fine. The umlauts are displayed 
correctly. But with 1.9 an exception occurs: 
org.yaml.snakeyaml.reader.ReaderException. See [^i18n_test.stacktrace]. The 
corresponding part of PsychParser.java in the source code of JRuby 1.6.1 is 
already marked with a FIXME.

Testcase:

{noformat}
$ tar -zxvf i18n_test.tar.gz
$ cd i18n_test
$ file config/locales/*
config/locales/en.yml: UTF-8 Unicode text
$ jruby --1.9 -S gem install bundler
$ jruby --1.9 -S bundle install
{noformat}

Testcase with compatibility mode 1.8:

{noformat}
$ jruby --1.8 -S script/rails server
{noformat}

* http://localhost:3000/

Testcase with compatibility mode 1.9:

{noformat}
$ jruby --1.9 -S script/rails server
{noformat}

* http://localhost:3000/

JRuby version:

{noformat}
$ jruby --1.9 --version
jruby 1.6.1 (ruby-1.9.2-p136) (2011-04-12 85838f6) (Java HotSpot(TM) Client VM 
1.6.0_24) [linux-i386-java]

$ jruby --1.8 --version
jruby 1.6.1 (ruby-1.8.7-p330) (2011-04-12 85838f6) (Java HotSpot(TM) Client VM 
1.6.0_24) [linux-i386-java]
{noformat}

h2. Workaround

Using HTML character entity references instead of UTF-8 encoded characters in 
the locale file is a workaround. But then all affected YAML keys must be 
suffixed with _html.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to