Imported Upstream version 0.7.3

parent a39122bf
/Gemfile.lock
.bundle/ .bundle/
tmp/ tmp/
vendor/ vendor/
......
source :rubygems source "https://rubygems.org"
gemspec gemspec
\ No newline at end of file
PATH
remote: .
specs:
charlock_holmes (0.6.9.4)
GEM
remote: http://rubygems.org/
specs:
chardet (0.9.0)
minitest (4.6.2)
rake (0.9.2)
rake-compiler (0.7.9)
rake
PLATFORMS
ruby
DEPENDENCIES
chardet
charlock_holmes!
minitest
rake-compiler (>= 0.7.5)
Copyright (c) 2011 Brian Lopez - http://github.com/brianmario Copyright (c) 2011 Brian Lopez - https://github.com/brianmario
Permission is hereby granted, free of charge, to any person obtaining Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the a copy of this software and associated documentation files (the
......
...@@ -4,17 +4,19 @@ require './lib/charlock_holmes/version' unless defined? CharlockHolmes::VERSION ...@@ -4,17 +4,19 @@ require './lib/charlock_holmes/version' unless defined? CharlockHolmes::VERSION
Gem::Specification.new do |s| Gem::Specification.new do |s|
s.name = %q{charlock_holmes} s.name = %q{charlock_holmes}
s.license = "MIT"
s.version = CharlockHolmes::VERSION s.version = CharlockHolmes::VERSION
s.authors = ["Brian Lopez", "Vicent Martí"] s.authors = ["Brian Lopez", "Vicent Martí"]
s.date = Time.now.utc.strftime("%Y-%m-%d") s.date = Time.now.utc.strftime("%Y-%m-%d")
s.email = %q{seniorlopez@gmail.com} s.email = %q{seniorlopez@gmail.com}
s.extensions = ["ext/charlock_holmes/extconf.rb"] s.extensions = ["ext/charlock_holmes/extconf.rb"]
s.files = `git ls-files`.split("\n") s.files = `git ls-files`.split("\n")
s.homepage = %q{http://github.com/brianmario/charlock_holmes} s.homepage = %q{https://github.com/brianmario/charlock_holmes}
s.rdoc_options = ["--charset=UTF-8"] s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"] s.require_paths = ["lib"]
s.rubygems_version = %q{1.4.2} s.rubygems_version = %q{1.4.2}
s.summary = %q{Character encoding detection, brought to you by ICU} s.summary = %q{Character encoding detection, brought to you by ICU}
s.description = "charlock_holmes provides binary and text detection as well as text transcoding using libicu"
s.test_files = `git ls-files spec`.split("\n") s.test_files = `git ls-files spec`.split("\n")
# tests # tests
......
#include "unicode/ucsdet.h" #include "unicode/ucsdet.h"
#include "magic.h"
#include "common.h" #include "common.h"
extern VALUE rb_mCharlockHolmes; extern VALUE rb_mCharlockHolmes;
...@@ -7,7 +6,6 @@ static VALUE rb_cEncodingDetector; ...@@ -7,7 +6,6 @@ static VALUE rb_cEncodingDetector;
typedef struct { typedef struct {
UCharsetDetector *csd; UCharsetDetector *csd;
magic_t magic;
} charlock_detector_t; } charlock_detector_t;
static VALUE rb_encdec_buildmatch(const UCharsetMatch *match) static VALUE rb_encdec_buildmatch(const UCharsetMatch *match)
...@@ -17,6 +15,9 @@ static VALUE rb_encdec_buildmatch(const UCharsetMatch *match) ...@@ -17,6 +15,9 @@ static VALUE rb_encdec_buildmatch(const UCharsetMatch *match)
const char *mlang; const char *mlang;
int mconfidence; int mconfidence;
VALUE rb_match; VALUE rb_match;
VALUE enc_tbl;
VALUE enc_name;
VALUE compat_enc;
if (!match) if (!match)
return Qnil; return Qnil;
...@@ -28,7 +29,16 @@ static VALUE rb_encdec_buildmatch(const UCharsetMatch *match) ...@@ -28,7 +29,16 @@ static VALUE rb_encdec_buildmatch(const UCharsetMatch *match)
rb_match = rb_hash_new(); rb_match = rb_hash_new();
rb_hash_aset(rb_match, ID2SYM(rb_intern("type")), ID2SYM(rb_intern("text"))); rb_hash_aset(rb_match, ID2SYM(rb_intern("type")), ID2SYM(rb_intern("text")));
rb_hash_aset(rb_match, ID2SYM(rb_intern("encoding")), charlock_new_str2(mname));
enc_name = charlock_new_str2(mname);
rb_hash_aset(rb_match, ID2SYM(rb_intern("encoding")), enc_name);
enc_tbl = rb_iv_get(rb_cEncodingDetector, "@encoding_table");
compat_enc = rb_hash_aref(enc_tbl, enc_name);
if (!NIL_P(compat_enc)) {
rb_hash_aset(rb_match, ID2SYM(rb_intern("ruby_encoding")), compat_enc);
}
rb_hash_aset(rb_match, ID2SYM(rb_intern("confidence")), INT2NUM(mconfidence)); rb_hash_aset(rb_match, ID2SYM(rb_intern("confidence")), INT2NUM(mconfidence));
if (mlang && mlang[0]) if (mlang && mlang[0])
...@@ -48,19 +58,75 @@ static VALUE rb_encdec_binarymatch() { ...@@ -48,19 +58,75 @@ static VALUE rb_encdec_binarymatch() {
return rb_match; return rb_match;
} }
static int detect_binary_content(charlock_detector_t *detector, VALUE rb_str) { static int detect_binary_content(VALUE self, VALUE rb_str) {
const char *binary_result; size_t buf_len, scan_len;
const char *buf;
buf = RSTRING_PTR(rb_str);
buf_len = RSTRING_LEN(rb_str);
scan_len = NUM2ULL(rb_iv_get(self, "@binary_scan_length"));
if (buf_len > 10) {
// application/postscript
if (!memcmp(buf, "%!PS-Adobe-", 11))
return 0;
}
if (buf_len > 7) {
// image/png
if (!memcmp(buf, "\x89PNG\x0D\x0A\x1A\x0A", 8))
return 1;
}
binary_result = magic_buffer(detector->magic, RSTRING_PTR(rb_str), RSTRING_LEN(rb_str)); if (buf_len > 5) {
// image/gif
if (!memcmp(buf, "GIF87a", 6))
return 1;
// image/gif
if (!memcmp(buf, "GIF89a", 6))
return 1;
}
if (binary_result) { if (buf_len > 4) {
if (!strstr(binary_result, "text")) // application/pdf
if (!memcmp(buf, "%PDF-", 5))
return 1; return 1;
} else {
rb_raise(rb_eStandardError, "%s", magic_error(detector->magic));
} }
return 0; if (buf_len > 3) {
// UTF-32BE
if (!memcmp(buf, "\0\0\xfe\xff", 4))
return 0;
// UTF-32LE
if (!memcmp(buf, "\xff\xfe\0\0", 4))
return 0;
}
if (buf_len > 2) {
// image/jpeg
if (!memcmp(buf, "\xFF\xD8\xFF", 3))
return 1;
}
if (buf_len > 1) {
// UTF-16BE
if (!memcmp(buf, "\xfe\xff", 2))
return 0;
// UTF-16LE
if (!memcmp(buf, "\xff\xfe", 2))
return 0;
}
/*
* If we got this far, any NULL bytes within the `scan_len`
* range will likely mean the contents are binary.
*/
if (scan_len < buf_len)
buf_len = scan_len;
return !!memchr(buf, 0, buf_len);
} }
/* /*
...@@ -87,7 +153,7 @@ static VALUE rb_encdec_detect(int argc, VALUE *argv, VALUE self) ...@@ -87,7 +153,7 @@ static VALUE rb_encdec_detect(int argc, VALUE *argv, VALUE self)
Data_Get_Struct(self, charlock_detector_t, detector); Data_Get_Struct(self, charlock_detector_t, detector);
// first lets see if this is binary content // first lets see if this is binary content
if (detect_binary_content(detector, rb_str)) { if (detect_binary_content(self, rb_str)) {
return rb_encdec_binarymatch(); return rb_encdec_binarymatch();
} }
...@@ -138,7 +204,7 @@ static VALUE rb_encdec_detect_all(int argc, VALUE *argv, VALUE self) ...@@ -138,7 +204,7 @@ static VALUE rb_encdec_detect_all(int argc, VALUE *argv, VALUE self)
// first lets see if this is binary content // first lets see if this is binary content
binary_match = Qnil; binary_match = Qnil;
if (detect_binary_content(detector, rb_str)) { if (detect_binary_content(self, rb_str)) {
binary_match = rb_encdec_binarymatch(); binary_match = rb_encdec_binarymatch();
} }
...@@ -233,6 +299,12 @@ static VALUE rb_get_supported_encodings(VALUE klass) ...@@ -233,6 +299,12 @@ static VALUE rb_get_supported_encodings(VALUE klass)
rb_encoding_list = rb_ary_new(); rb_encoding_list = rb_ary_new();
enc_count = uenum_count(encoding_list, &status); enc_count = uenum_count(encoding_list, &status);
rb_ary_push(rb_encoding_list, charlock_new_str2("windows-1250"));
rb_ary_push(rb_encoding_list, charlock_new_str2("windows-1252"));
rb_ary_push(rb_encoding_list, charlock_new_str2("windows-1253"));
rb_ary_push(rb_encoding_list, charlock_new_str2("windows-1254"));
rb_ary_push(rb_encoding_list, charlock_new_str2("windows-1255"));
for(i=0; i < enc_count; i++) { for(i=0; i < enc_count; i++) {
enc_name = uenum_next(encoding_list, &enc_name_len, &status); enc_name = uenum_next(encoding_list, &enc_name_len, &status);
rb_ary_push(rb_encoding_list, charlock_new_str(enc_name, enc_name_len)); rb_ary_push(rb_encoding_list, charlock_new_str(enc_name, enc_name_len));
...@@ -254,9 +326,6 @@ static void rb_encdec__free(void *obj) ...@@ -254,9 +326,6 @@ static void rb_encdec__free(void *obj)
if (detector->csd) if (detector->csd)
ucsdet_close(detector->csd); ucsdet_close(detector->csd);
if (detector->magic)
magic_close(detector->magic);
free(detector); free(detector);
} }
...@@ -274,11 +343,6 @@ static VALUE rb_encdec__alloc(VALUE klass) ...@@ -274,11 +343,6 @@ static VALUE rb_encdec__alloc(VALUE klass)
rb_raise(rb_eStandardError, "%s", u_errorName(status)); rb_raise(rb_eStandardError, "%s", u_errorName(status));
} }
detector->magic = magic_open(MAGIC_NO_CHECK_SOFT);
if (detector->magic == NULL) {
rb_raise(rb_eStandardError, "%s", magic_error(detector->magic));
}
return obj; return obj;
} }
......
...@@ -4,7 +4,7 @@ CWD = File.expand_path(File.dirname(__FILE__)) ...@@ -4,7 +4,7 @@ CWD = File.expand_path(File.dirname(__FILE__))
def sys(cmd) def sys(cmd)
puts " -- #{cmd}" puts " -- #{cmd}"
unless ret = xsystem(cmd) unless ret = xsystem(cmd)
raise "#{cmd} failed, please report issue on http://github.com/brianmario/charlock_holmes" raise "#{cmd} failed, please report issue on https://github.com/brianmario/charlock_holmes"
end end
ret ret
end end
...@@ -23,6 +23,7 @@ end ...@@ -23,6 +23,7 @@ end
dir_config 'icu' dir_config 'icu'
rubyopt = ENV.delete("RUBYOPT")
# detect homebrew installs # detect homebrew installs
if !have_library 'icui18n' if !have_library 'icui18n'
base = if !`which brew`.empty? base = if !`which brew`.empty?
...@@ -45,40 +46,12 @@ unless have_library 'icui18n' and have_header 'unicode/ucnv.h' ...@@ -45,40 +46,12 @@ unless have_library 'icui18n' and have_header 'unicode/ucnv.h'
exit(1) exit(1)
end end
## have_library 'z' or abort 'libz missing'
# libmagic dependency have_library 'icuuc' or abort 'libicuuc missing'
# have_library 'icudata' or abort 'libicudata missing'
src = File.basename('file-5.08.tar.gz')
dir = File.basename(src, '.tar.gz')
Dir.chdir("#{CWD}/src") do
FileUtils.rm_rf(dir) if File.exists?(dir)
sys("tar zxvf #{src}")
Dir.chdir(dir) do
sys("./configure --prefix=#{CWD}/dst/ --disable-shared --enable-static --with-pic")
sys("patch -p0 < ../file-soft-check.patch")
sys("make -C src install")
sys("make -C magic install")
end
end
FileUtils.cp "#{CWD}/dst/lib/libmagic.a", "#{CWD}/libmagic_ext.a"
$INCFLAGS[0,0] = " -I#{CWD}/dst/include "
$LDFLAGS << " -L#{CWD} "
dir_config 'magic'
unless have_library 'magic_ext' and have_header 'magic.h'
STDERR.puts "\n\n"
STDERR.puts "***************************************************************************************"
STDERR.puts "********* error compiling and linking libmagic. please report issue on github *********"
STDERR.puts "***************************************************************************************"
exit(1)
end
$CFLAGS << ' -Wall -funroll-loops' $CFLAGS << ' -Wall -funroll-loops'
$CFLAGS << ' -Wextra -O0 -ggdb3' if ENV['DEBUG'] $CFLAGS << ' -Wextra -O0 -ggdb3' if ENV['DEBUG']
ENV['RUBYOPT'] = rubyopt
create_makefile 'charlock_holmes/charlock_holmes' create_makefile 'charlock_holmes/charlock_holmes'
module CharlockHolmes module CharlockHolmes
class EncodingDetector class EncodingDetector
# Default length for which to scan content for NULL bytes
DEFAULT_BINARY_SCAN_LEN = 1024*1024
# Length for which to scan content for NULL bytes
attr_accessor :binary_scan_length
alias :strip_tags? :strip_tags alias :strip_tags? :strip_tags
def initialize(scan_len=DEFAULT_BINARY_SCAN_LEN)
@binary_scan_length = scan_len
end
# Attempt to detect the encoding of this string # Attempt to detect the encoding of this string
# #
# NOTE: This will create a new CharlockHolmes::EncodingDetector instance on every call # NOTE: This will create a new CharlockHolmes::EncodingDetector instance on every call
# as well as use the default binary scan length
# #
# str - a String, what you want to detect the encoding of # str - a String, what you want to detect the encoding of
# hint_enc - an optional String (like "UTF-8"), the encoding name which will # hint_enc - an optional String (like "UTF-8"), the encoding name which will
...@@ -19,6 +30,7 @@ module CharlockHolmes ...@@ -19,6 +30,7 @@ module CharlockHolmes
# a list with all the possible encodings that match it. # a list with all the possible encodings that match it.
# #
# NOTE: This will create a new CharlockHolmes::EncodingDetector instance on every call # NOTE: This will create a new CharlockHolmes::EncodingDetector instance on every call
# as well as use the default binary scan length
# #
# str - a String, what you want to detect the encoding of # str - a String, what you want to detect the encoding of
# hint_enc - an optional String (like "UTF-8"), the encoding name which will # hint_enc - an optional String (like "UTF-8"), the encoding name which will
...@@ -29,5 +41,36 @@ module CharlockHolmes ...@@ -29,5 +41,36 @@ module CharlockHolmes
def self.detect_all(str, hint_enc=nil) def self.detect_all(str, hint_enc=nil)
new.detect_all(str, hint_enc) new.detect_all(str, hint_enc)
end end
# A mapping table of supported encoding names from EncodingDetector
# which point to the corresponding supported encoding name in Ruby.
# Like: {"UTF-8" => "UTF-8", "IBM420_rtl" => "ASCII-8BIT"}
#
# Note that encodings that can't be mapped between Charlock and Ruby will resolve
# to "ASCII-8BIT".
@encoding_table = {}
def self.encoding_table
@encoding_table
end
BINARY = 'binary'
# Builds the ENCODING_TABLE hash by running through the list of supported encodings
# in the ICU detection API and trying to map them to supported encodings in Ruby.
# This is built dynamically so as to take advantage of ICU upgrades which may have
# support for more encodings in the future.
#
# Returns nothing.
def self.build_encoding_table
supported_encodings.each do |name|
@encoding_table[name] = begin
::Encoding.find(name).name
rescue ArgumentError
BINARY
end
end
end
build_encoding_table
end end
end end
\ No newline at end of file
...@@ -19,14 +19,14 @@ class String ...@@ -19,14 +19,14 @@ class String
detector.detect_all(self, hint_enc) detector.detect_all(self, hint_enc)
end end
if RUBY_VERSION =~ /1.9/ if method_defined? :force_encoding
# Attempt to detect the encoding of this string # Attempt to detect the encoding of this string
# then set the encoding to what was detected ala `force_encoding` # then set the encoding to what was detected ala `force_encoding`
# #
# Returns: self # Returns: self
def detect_encoding!(hint_enc=nil) def detect_encoding!(hint_enc=nil)
if detected = self.detect_encoding(hint_enc) if detected = self.detect_encoding(hint_enc)
self.force_encoding(detected[:encoding]) if detected[:encoding] self.force_encoding(detected[:ruby_encoding]) if detected[:ruby_encoding]
end end
self self
end end
......
module CharlockHolmes module CharlockHolmes
VERSION = "0.6.9.4" VERSION = "0.7.3"
end end
--- !ruby/object:Gem::Specification --- !ruby/object:Gem::Specification
name: charlock_holmes name: charlock_holmes
version: !ruby/object:Gem::Version version: !ruby/object:Gem::Version
version: 0.6.9.4 version: 0.7.3
prerelease:
platform: ruby platform: ruby
authors: authors:
- Brian Lopez - Brian Lopez
...@@ -10,57 +9,52 @@ authors: ...@@ -10,57 +9,52 @@ authors:
autorequire: autorequire:
bindir: bin bindir: bin
cert_chain: [] cert_chain: []
date: 2013-04-03 00:00:00.000000000 Z date: 2014-06-07 00:00:00.000000000 Z
dependencies: dependencies:
- !ruby/object:Gem::Dependency - !ruby/object:Gem::Dependency
name: rake-compiler name: rake-compiler
requirement: !ruby/object:Gem::Requirement requirement: !ruby/object:Gem::Requirement
none: false
requirements: requirements:
- - ! '>=' - - '>='
- !ruby/object:Gem::Version - !ruby/object:Gem::Version
version: 0.7.5 version: 0.7.5
type: :development type: :development
prerelease: false prerelease: false
version_requirements: !ruby/object:Gem::Requirement version_requirements: !ruby/object:Gem::Requirement
none: false
requirements: requirements:
- - ! '>=' - - '>='
- !ruby/object:Gem::Version - !ruby/object:Gem::Version
version: 0.7.5 version: 0.7.5
- !ruby/object:Gem::Dependency - !ruby/object:Gem::Dependency
name: minitest name: minitest
requirement: !ruby/object:Gem::Requirement requirement: !ruby/object:Gem::Requirement
none: false
requirements: requirements:
- - ! '>=' - - '>='
- !ruby/object:Gem::Version - !ruby/object:Gem::Version
version: '0' version: '0'
type: :development type: :development
prerelease: false prerelease: false
version_requirements: !ruby/object:Gem::Requirement version_requirements: !ruby/object:Gem::Requirement
none: false
requirements: requirements:
- - ! '>=' - - '>='
- !ruby/object:Gem::Version - !ruby/object:Gem::Version
version: '0' version: '0'
- !ruby/object:Gem::Dependency - !ruby/object:Gem::Dependency
name: chardet name: chardet
requirement: !ruby/object:Gem::Requirement requirement: !ruby/object:Gem::Requirement
none: false
requirements: requirements:
- - ! '>=' - - '>='
- !ruby/object:Gem::Version - !ruby/object:Gem::Version
version: '0' version: '0'
type: :development type: :development
prerelease: false prerelease: false
version_requirements: !ruby/object:Gem::Requirement version_requirements: !ruby/object:Gem::Requirement
none: false
requirements: requirements:
- - ! '>=' - - '>='
- !ruby/object:Gem::Version - !ruby/object:Gem::Version
version: '0' version: '0'
description: description: charlock_holmes provides binary and text detection as well as text transcoding
using libicu
email: seniorlopez@gmail.com email: seniorlopez@gmail.com
executables: [] executables: []
extensions: extensions:
...@@ -69,7 +63,6 @@ extra_rdoc_files: [] ...@@ -69,7 +63,6 @@ extra_rdoc_files: []
files: files:
- .gitignore - .gitignore
- Gemfile - Gemfile
- Gemfile.lock
- MIT-LICENSE - MIT-LICENSE
- README.md - README.md
- Rakefile - Rakefile
...@@ -81,8 +74,6 @@ files: ...@@ -81,8 +74,6 @@ files:
- ext/charlock_holmes/encoding_detector.c - ext/charlock_holmes/encoding_detector.c
- ext/charlock_holmes/ext.c - ext/charlock_holmes/ext.c
- ext/charlock_holmes/extconf.rb - ext/charlock_holmes/extconf.rb
- ext/charlock_holmes/src/file-5.08.tar.gz
- ext/charlock_holmes/src/file-soft-check.patch
- ext/charlock_holmes/transliterator.cpp - ext/charlock_holmes/transliterator.cpp
- lib/charlock_holmes.rb - lib/charlock_holmes.rb
- lib/charlock_holmes/encoding_detector.rb - lib/charlock_holmes/encoding_detector.rb
...@@ -91,38 +82,51 @@ files: ...@@ -91,38 +82,51 @@ files:
- test/converter_test.rb - test/converter_test.rb
- test/encoding_detector_test.rb - test/encoding_detector_test.rb
- test/fixtures/AnsiGraph.psm1 - test/fixtures/AnsiGraph.psm1
- test/fixtures/ISO-2022-KR.txt
- test/fixtures/TwigExtensionsDate.es.yml - test/fixtures/TwigExtensionsDate.es.yml
- test/fixtures/cl-messagepack.lisp - test/fixtures/cl-messagepack.lisp
- test/fixtures/core.rkt - test/fixtures/core.rkt
- test/fixtures/foo.pdf
- test/fixtures/hello_world - test/fixtures/hello_world
- test/fixtures/laholator.py - test/fixtures/laholator.py
- test/fixtures/octocat.ai
- test/fixtures/octocat.gif
- test/fixtures/octocat.jpg
- test/fixtures/octocat.png
- test/fixtures/octocat.psd
- test/fixtures/repl2.cljs - test/fixtures/repl2.cljs
- test/fixtures/sierpinski.ps
- test/fixtures/utf16be.html
- test/fixtures/utf32be.html
- test/fixtures/utf32le.html
- test/fixtures/utf8.html
- test/fixtures/vimrc
- test/helper.rb - test/helper.rb
- test/string_methods_test.rb - test/string_methods_test.rb
- test/transliterator_test.rb - test/transliterator_test.rb
homepage: http://github.com/brianmario/charlock_holmes homepage: https://github.com/brianmario/charlock_holmes
licenses: [] licenses:
- MIT
metadata: {}
post_install_message: post_install_message:
rdoc_options: rdoc_options:
- --charset=UTF-8 - --charset=UTF-8
require_paths: require_paths:
- lib - lib
required_ruby_version: !ruby/object:Gem::Requirement required_ruby_version: !ruby/object:Gem::Requirement
none: false
requirements: requirements:
- - ! '>=' - - '>='
- !ruby/object:Gem::Version - !ruby/object:Gem::Version
version: '0' version: '0'
required_rubygems_version: !ruby/object:Gem::Requirement required_rubygems_version: !ruby/object:Gem::Requirement
none: false
requirements: requirements:
- - ! '>=' - - '>='
- !ruby/object:Gem::Version - !ruby/object:Gem::Version
version: '0' version: '0'
requirements: [] requirements: []
rubyforge_project: rubyforge_project:
rubygems_version: 1.8.23 rubygems_version: 2.0.3
signing_key: signing_key:
specification_version: 3 specification_version: 4
summary: Character encoding detection, brought to you by ICU summary: Character encoding detection, brought to you by ICU
test_files: [] test_files: []
# encoding: utf-8 # encoding: utf-8
require File.expand_path("../helper", __FILE__) require File.expand_path("../helper", __FILE__)
class ConverterTest < MiniTest::Unit::TestCase class ConverterTest < MiniTest::Test
def test_convert_ascii_from_iso859_1_to_utf16_and_back def test_convert_ascii_from_iso859_1_to_utf16_and_back
input = 'test' input = 'test'
......
# encoding: utf-8 # encoding: utf-8
require File.expand_path("../helper", __FILE__) require File.expand_path("../helper", __FILE__)
class EncodingDetectorTest < MiniTest::Unit::TestCase class EncodingDetectorTest < MiniTest::Test
def setup def setup
@detector = CharlockHolmes::EncodingDetector.new @detector = CharlockHolmes::EncodingDetector.new
end