Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions ext/charlock_holmes/encoding_detector.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ static VALUE rb_encdec_binarymatch(void) {
rb_match = rb_hash_new();

rb_hash_aset(rb_match, ID2SYM(rb_intern("type")), ID2SYM(rb_intern("binary")));
rb_hash_aset(rb_match, ID2SYM(rb_intern("encoding")), charlock_new_str2("BINARY"));
rb_hash_aset(rb_match, ID2SYM(rb_intern("ruby_encoding")), charlock_new_str2("ASCII-8BIT"));
rb_hash_aset(rb_match, ID2SYM(rb_intern("confidence")), INT2NUM(100));

return rb_match;
Expand Down
18 changes: 7 additions & 11 deletions test/encoding_detector_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,6 @@ def test_returns_a_ruby_compatible_encoding_name
detected = @detector.detect not_compat_txt
assert_equal 'ISO-2022-KR', detected[:encoding]
assert_equal 'binary', detected[:ruby_encoding]

detected = @detector.detect "\0\0"
assert_equal 'BINARY', detected[:encoding]
assert_equal 'ASCII-8BIT', detected[:ruby_encoding]
end

def test_is_binary
Expand All @@ -136,13 +132,13 @@ def test_is_binary
['utf16be.html', 'UTF-16BE', :text],
['utf32le.html', 'UTF-32LE', :text],
['utf32be.html', 'UTF-32BE', :text],
['hello_world', 'BINARY', :binary],
['octocat.png', 'BINARY', :binary],
['octocat.jpg', 'BINARY', :binary],
['octocat.psd', 'BINARY', :binary],
['octocat.gif', 'BINARY', :binary],
['octocat.ai', 'BINARY', :binary],
['foo.pdf', 'BINARY', :binary],
['hello_world', nil, :binary],
['octocat.png', nil, :binary],
['octocat.jpg', nil, :binary],
['octocat.psd', nil, :binary],
['octocat.gif', nil, :binary],
['octocat.ai', nil, :binary],
['foo.pdf', nil, :binary],
]

def test_detection_works_as_expected
Expand Down