JRuby 1.7.1 and PsychParser error parsing UTF-8 YAML file (Rails 3.2.8)
Asked Answered
V

1

10

In our JRuby/Rails project, we are using the i18n gem, and support Japanese as well as English. Our config/locales.ja.yml file is in UTF-8, without any BOM.

When running Rails 3.2.9 on JRuby 1.7.1, we now see the following error:

% jruby -S rake spec:models

 Psych::SyntaxError: (C:/Projects/foobar/trunk/config/locales/ja.yml): 
   expected <block end>, but found Scalar while parsing a block 
   mapping at line 7 column 33

   parse at org/jruby/ext/psych/PsychParser.java:213
   ... 

This error for YAML parsing the ja.yml file is now happening on both our Windows XP and Linux development environments, and only seems to go away when we explicitly set the following system parameter for the JVM:

-Dfile.encoding=utf-8

Could anyone tell me why this is happening on JRuby 1.7.1?
I didn't see this in 1.6.8 or 1.7.0.

Veradi answered 12/12, 2012 at 7:48 Comment(4)
Faced same thing with Jruby1.7, Rails 3.2.13 under Windows but without error or exception, just garpish text instead of Arabic .. running SET JAVA_TOOL_OPTIONS= "-Dfile.encoding=UTF8" worked for me tooAdelleadelpho
Happens to be a bug jira.codehaus.org/browse/JRUBY-7142; fixed since 1.7.5Variscite
@Variscite "fixed since 1.7.5"? It still appears that the latest release to date is 1.7.4...Veradi
1.7.5 is available at github.com/jruby/jruby, from sourcesVariscite
P
0

Over a year old now, but here is the answer:

http://jruby.org/2012/12/03/jruby-1-7-1.html

In that release, this happened:

  • Psych YAML engine updated to latest
Pochard answered 15/12, 2013 at 10:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.