Issue Type: Bug Bug
Affects Versions: JRuby 1.7.0
Assignee: Unassigned
Attachments: rexml_error.rb
Components: Core Classes/Modules, Encoding
Created: 26/Nov/12 10:59 AM
Description:

NoMethodError: undefined method `search_convpath' for Encoding::Converter:Class

Error rises with explicitly defined charset in xml and it's not utf-8.

Error backtrace

NoMethodError: undefined method `search_convpath' for Encoding::Converter:Class
  find_encoding at /home/sqrel/.rvm/rubies/jruby-1.7.0/lib/ruby/1.9/rexml/encoding.rb:55
      encoding= at /home/sqrel/.rvm/rubies/jruby-1.7.0/lib/ruby/1.9/rexml/encoding.rb:9
      encoding= at /home/sqrel/.rvm/rubies/jruby-1.7.0/lib/ruby/1.9/rexml/source.rb:55
     initialize at /home/sqrel/.rvm/rubies/jruby-1.7.0/lib/ruby/1.9/rexml/source.rb:46
     initialize at /home/sqrel/.rvm/rubies/jruby-1.7.0/lib/ruby/1.9/rexml/source.rb:162
    create_from at /home/sqrel/.rvm/rubies/jruby-1.7.0/lib/ruby/1.9/rexml/source.rb:17
        stream= at /home/sqrel/.rvm/rubies/jruby-1.7.0/lib/ruby/1.9/rexml/parsers/baseparser.rb:127
     initialize at /home/sqrel/.rvm/rubies/jruby-1.7.0/lib/ruby/1.9/rexml/parsers/baseparser.rb:116
         (root) at ./rexml_error.rb:11
{/code}

Bug reproduction:
{code:ruby}
require 'rexml/parsers/streamparser'
require 'rexml/parsers/baseparser'
require 'rexml/light/node'
require 'rexml/text'

xml = "<?xml version=\"1.0\" encoding=\"windows-1251\"?> <catalog>  <book id=\"bk101\">  <author>Gambardella, Matthew</author>  <title>XML Developer's Guide</title>  <genre>Computer</genre>  <price>44.95</price>  <publish_date>2000-10-01</publish_date>  <description>An in-depth look at creating applications   with XML.</description>  </book> </catalog>"
parser = REXML::Parsers::BaseParser.new(xml)
{/code}

Calling stack:

lib/ruby/1.9/rexml/parsers/baseparser.rb:127 SourceFactory.create_from(source)
lib/ruby/1.9/rexml/source.rb:17 IOSource.new(StringIO.new(arg))
lib/ruby/1.9/rexml/source.rb:46 self.encoding = check_encoding( @buffer )
lib/ruby/1.9/rexml/source.rb:55 return unless super
lib/ruby/1.9/rexml/encoding.rb:9 encoding = find_encoding(encoding)
lib/ruby/1.9/rexml/encoding.rb:55 ::Encoding::Converter.search_convpath(name, 'UTF-8')

{/code}

Bugfix with monkey patching (code was taken from Rubinius)

Unable to find source-code formatter for language: ruby. Available languages are: _javascript_, sql, xhtml, actionscript, none, html, xml, java
Encoding::Converter.instance_eval do
    def search_convpath(from, to, options={})
      new(from, to, options).convpath
    end
end
Environment: arch linux 3.6.6-1, rvm 1.16.20
Project: JRuby
Labels: jruby encoding
Priority: Minor Minor
Reporter: Vasilij Melnychuck
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
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