Encoding::CompatibilityError with utf-16 and ruby-1.9.3-preview1 #9

Closed
rubiii opened this Issue Aug 25, 2011 · 3 comments

Projects

None yet

3 participants

@rubiii
rubiii commented Aug 25, 2011

don't know if it's too early to open a ticket for this, but one of my tests if failing on ruby-1.9.3-preview1
and it seems to be a problem related to builder:

xml = Builder::XmlMarkup.new
xml.instruct!(:xml, :encoding => "UTF-16") 

Encoding::CompatibilityError: incompatible encoding regexp match (US-ASCII regexp with UTF-16 string)
    from /Users/rubiii/.rvm/gems/ruby-1.9.3-preview1/gems/builder-3.0.0/lib/builder/xmlbase.rb:140:in `gsub'
    from /Users/rubiii/.rvm/gems/ruby-1.9.3-preview1/gems/builder-3.0.0/lib/builder/xmlbase.rb:140:in `_escape_quote'
    from /Users/rubiii/.rvm/gems/ruby-1.9.3-preview1/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:320:in `_attr_value'
    from /Users/rubiii/.rvm/gems/ruby-1.9.3-preview1/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:308:in `block in _insert_attributes'
    from /Users/rubiii/.rvm/gems/ruby-1.9.3-preview1/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:306:in `each'
    from /Users/rubiii/.rvm/gems/ruby-1.9.3-preview1/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:306:in `_insert_attributes'
    from /Users/rubiii/.rvm/gems/ruby-1.9.3-preview1/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:284:in `_special'
    from /Users/rubiii/.rvm/gems/ruby-1.9.3-preview1/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:250:in `instruct!'
    from (irb):3
    from /Users/rubiii/.rvm/rubies/ruby-1.9.3-preview1/bin/irb:16:in `<main>'
@terceiro

A similar error (probably with the same cause) happens when running the automated tests under ruby 1.9.3:

$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
$ rake
WARNING: 'require 'rake/rdoctask'' is deprecated.  Please use 'require 'rdoc/task' (in RDoc 2.4.2+)' instead.
    at /home/terceiro/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/rake/rdoctask.rb
rake/gempackagetask is deprecated.  Use rubygems/package_task instead
Run options: 

# Running tests:

..............................................................E........................................................

Finished tests in 0.031833s, 3738.2273 tests/s, 5403.1521 assertions/s.

  1) Error:
test_use_entities_if_kcode_is_utf_but_encoding_is_something_else(TestIndentedXmlMarkup::TestUtfMarkup):
Encoding::CompatibilityError: incompatible encoding regexp match (US-ASCII regexp with UTF-16 string)
    /tmp/builder/lib/builder/xmlbase.rb:140:in `gsub'
    /tmp/builder/lib/builder/xmlbase.rb:140:in `_escape_quote'
    /tmp/builder/lib/builder/xmlmarkup.rb:320:in `_attr_value'
    /tmp/builder/lib/builder/xmlmarkup.rb:308:in `block in _insert_attributes'
    /tmp/builder/lib/builder/xmlmarkup.rb:306:in `each'
    /tmp/builder/lib/builder/xmlmarkup.rb:306:in `_insert_attributes'
    /tmp/builder/lib/builder/xmlmarkup.rb:284:in `_special'
    /tmp/builder/lib/builder/xmlmarkup.rb:250:in `instruct!'
    /tmp/builder/test/test_markupbuilder.rb:451:in `test_use_entities_if_kcode_is_utf_but_encoding_is_something_else'

119 tests, 172 assertions, 0 failures, 1 errors, 0 skips
rake aborted!
Command failed with status (1): [/home/terceiro/.rbenv/versions/1.9.3-p0/bi...]

Tasks: TOP => default => test_all => test_units
(See full trace by running task with --trace)
@terceiro

this should be fixed by pull request #15

@jimweirich
Owner

fix merged

@jimweirich jimweirich closed this Sep 6, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment