Closed dcparker closed 11 years ago
Even after changing line 250 I get this error:
/opt/ruby-1.9.1-p243/lib/ruby/gems/1.9.1/gems/shared-mime-info-0.1/lib/shared-mime-info.rb:345:in `block (2 levels) in load_magic': invalid byte sequence in UTF-8 (ArgumentError)
Any clues?
Got this same error on 1.9 Ubuntu stock installation. Works fine with 1.8 though.
i got, too
Try adding the following near the top of shared-mime-info.rb:
require 'unicode'
class String
def to_ascii_unicode
Unicode.normalize_KD(self).unpack('U*').select{ |cp| cp < 127 }.pack('U*')
end
end
and add ".to_ascii_unicode" to the end of what will now be #359, "buf << line"
Someone please verify whether that works or not? I got that from http://www.jroller.com/obie/entry/fix_that_tranny_add_to, in case it doesn't work and you want to try some of the other methods there or learn more about the problem itself.
Another solution is to force the encoding in the File.open
call on line 335:
open(file) { |f|
becomes
open(file, 'r:ASCII-8BIT') { |f|
Still broken? :-(
I'm pretty sure this is fixed in master and 0.3.0. Let me know if it's not.
Contacted the author, hopefully it will be fixed soon.
To fix for ruby1.9, replace line 250 of shared-mime-info.rb with the following:
enum = @globs.each_key rescue Enumerable::Enumerator.new(@globs, :each_key)