REXML fails on XML with UTF-8-chars on jruby in 1.9-mode
--------------------------------------------------------
Key: JRUBY-6036
URL: https://jira.codehaus.org/browse/JRUBY-6036
Project: JRuby
Issue Type: Bug
Components: Ruby 1.9.2
Affects Versions: JRuby 1.6.4
Environment: Mac OS 10.6.8
$ ; java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03-384-10M3425)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-384, mixed mode)
$ ; jruby --1.9 -v
jruby 1.6.4 (ruby-1.9.2-p136) (2011-08-23 17ea768) (Java HotSpot(TM) Client VM
1.6.0_26) [darwin-i386-java]
Reporter: Mattias Amnefelt
Assignee: Thomas E Enebo
Attachments: kaka.rb, kaka.xml
When parsing an xml-file with utf-8 characters in it, using jruby 1.6.4 in ruby
1.9-mode I get the following exception thrown:
$ ; jruby --1.9 kaka.rb
REXML::ParseException: #<Encoding::CompatibilityError: incompatible encoding
regexp match (ASCII-8BIT regexp with UTF-8 string)>
org/jruby/RubyRegexp.java:1414:in `=~'
org/jruby/RubyString.java:1588:in `=~'
/Users/mattiasa/.rvm/rubies/jruby-1.6.4/lib/ruby/1.9/rexml/text.rb:131:in
`check'
/Users/mattiasa/.rvm/rubies/jruby-1.6.4/lib/ruby/1.9/rexml/attribute.rb:153:in
`element='
/Users/mattiasa/.rvm/rubies/jruby-1.6.4/lib/ruby/1.9/rexml/element.rb:1104:in
`[]='
/Users/mattiasa/.rvm/rubies/jruby-1.6.4/lib/ruby/1.9/rexml/parsers/treeparser.rb:35:in
`parse'
org/jruby/RubyHash.java:1175:in `each'
/Users/mattiasa/.rvm/rubies/jruby-1.6.4/lib/ruby/1.9/rexml/parsers/treeparser.rb:34:in
`parse'
/Users/mattiasa/.rvm/rubies/jruby-1.6.4/lib/ruby/1.9/rexml/document.rb:230:in
`build'
/Users/mattiasa/.rvm/rubies/jruby-1.6.4/lib/ruby/1.9/rexml/document.rb:43:in
`initialize'
kaka.rb:3:in `(root)'
...
incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string)
Line: 2
Position: 60
Last 80 unconsumed characters:
parse at
/Users/mattiasa/.rvm/rubies/jruby-1.6.4/lib/ruby/1.9/rexml/parsers/treeparser.rb:95
build at
/Users/mattiasa/.rvm/rubies/jruby-1.6.4/lib/ruby/1.9/rexml/document.rb:230
initialize at
/Users/mattiasa/.rvm/rubies/jruby-1.6.4/lib/ruby/1.9/rexml/document.rb:43
(root) at kaka.rb:3
If I run the same code either with Jruby in 1.8-mode or with MRI ruby 1.9.2p180
(2011-02-18 revision 30909) it all works fine and dandy.
$ ; jruby --1.8 kaka.rb
<foo baz='Örjall'> ... </>
$ ; ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.6.0]
$ ; ruby kaka.rb
<foo baz='Örjall'> ... </>
--
This message is automatically generated by JIRA.
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