charlock_holmes 0.6.9 → 0.6.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.md +28 -5
- data/ext/charlock_holmes/converter.c +4 -0
- data/lib/charlock_holmes/string.rb +1 -1
- data/lib/charlock_holmes/version.rb +1 -1
- data/spec/converter_spec.rb +18 -0
- metadata +77 -60
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -77,12 +77,35 @@ The first parameter is the content to transcode, the second is the source encodi
|
|
77
77
|
|
78
78
|
## Installing
|
79
79
|
|
80
|
-
If the traditional `gem install charlock_holmes` doesn't work, you may need to specify the path to
|
80
|
+
If the traditional `gem install charlock_holmes` doesn't work, you may need to specify the path to
|
81
|
+
your installation of ICU using the `--with-icu-dir` option during the gem install or by configuring Bundler to
|
82
|
+
pass those arguments to Gem:
|
81
83
|
|
82
|
-
|
84
|
+
Configure Bundler to always use the correct arguments when installing:
|
83
85
|
|
84
|
-
|
86
|
+
bundle config build.charlock_holmes --with-icu-dir=/path/to/installed/icu4c
|
85
87
|
|
86
|
-
|
88
|
+
Using Gem to install directly without Bundler:
|
87
89
|
|
88
|
-
|
90
|
+
gem install charlock_holmes -- --with-icu-dir=/path/to/installed/icu4c
|
91
|
+
|
92
|
+
|
93
|
+
### Homebrew
|
94
|
+
|
95
|
+
If you're installing on Mac OS X then using [Homebrew](http://mxcl.github.com/homebrew/) is
|
96
|
+
the easiest way to install ICU.
|
97
|
+
|
98
|
+
However, be warned; it is a Keg-Only (see [homedir issue #167](https://github.com/mxcl/homebrew/issues/167)
|
99
|
+
for more info) install meaning RubyGems won't find it when installing without specifying `--with-icu-dir`
|
100
|
+
|
101
|
+
To install ICU with Homebrew:
|
102
|
+
|
103
|
+
brew install icu4c
|
104
|
+
|
105
|
+
Configure Bundler to always use the correct arguments when installing:
|
106
|
+
|
107
|
+
bundle config build.charlock_holmes --with-icu-dir=/usr/local/opt/icu4c
|
108
|
+
|
109
|
+
Using Gem to install directly without Bundler:
|
110
|
+
|
111
|
+
gem install charlock_holmes -- --with-icu-dir=/usr/local/opt/icu4c
|
@@ -15,6 +15,10 @@ static VALUE rb_converter_convert(VALUE self, VALUE rb_txt, VALUE rb_src_enc, VA
|
|
15
15
|
int32_t out_len;
|
16
16
|
UErrorCode status = U_ZERO_ERROR;
|
17
17
|
|
18
|
+
Check_Type(rb_txt, T_STRING);
|
19
|
+
Check_Type(rb_src_enc, T_STRING);
|
20
|
+
Check_Type(rb_dst_enc, T_STRING);
|
21
|
+
|
18
22
|
src_txt = RSTRING_PTR(rb_txt);
|
19
23
|
src_len = RSTRING_LEN(rb_txt);
|
20
24
|
src_enc = RSTRING_PTR(rb_src_enc);
|
data/spec/converter_spec.rb
CHANGED
@@ -26,4 +26,22 @@ describe CharlockHolmes::Converter do
|
|
26
26
|
assert input.bytesize == output.bytesize
|
27
27
|
assert input == output
|
28
28
|
end
|
29
|
+
|
30
|
+
test 'all params must be strings' do
|
31
|
+
assert_raises TypeError do
|
32
|
+
CharlockHolmes::Converter.convert nil, 'UTF-8', 'UTF-16'
|
33
|
+
end
|
34
|
+
|
35
|
+
assert_raises TypeError do
|
36
|
+
CharlockHolmes::Converter.convert 'lol', nil, 'UTF-16'
|
37
|
+
end
|
38
|
+
|
39
|
+
assert_raises TypeError do
|
40
|
+
CharlockHolmes::Converter.convert 'lol', 'UTF-8', nil
|
41
|
+
end
|
42
|
+
|
43
|
+
assert_nothing_raised do
|
44
|
+
CharlockHolmes::Converter.convert 'lol', 'UTF-8', 'UTF-16'
|
45
|
+
end
|
46
|
+
end
|
29
47
|
end
|
metadata
CHANGED
@@ -1,72 +1,80 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: charlock_holmes
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 89
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 6
|
9
|
+
- 9
|
10
|
+
- 1
|
11
|
+
version: 0.6.9.1
|
6
12
|
platform: ruby
|
7
|
-
authors:
|
13
|
+
authors:
|
8
14
|
- Brian Lopez
|
9
|
-
- Vicent
|
15
|
+
- "Vicent Mart\xC3\xAD"
|
10
16
|
autorequire:
|
11
17
|
bindir: bin
|
12
18
|
cert_chain: []
|
13
|
-
|
14
|
-
|
15
|
-
|
19
|
+
|
20
|
+
date: 2013-01-31 00:00:00 -08:00
|
21
|
+
default_executable:
|
22
|
+
dependencies:
|
23
|
+
- !ruby/object:Gem::Dependency
|
16
24
|
name: rake-compiler
|
17
|
-
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
|
-
requirements:
|
20
|
-
- - ! '>='
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 0.7.5
|
23
|
-
type: :development
|
24
25
|
prerelease: false
|
25
|
-
|
26
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
27
|
none: false
|
27
|
-
requirements:
|
28
|
-
- -
|
29
|
-
- !ruby/object:Gem::Version
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
hash: 9
|
32
|
+
segments:
|
33
|
+
- 0
|
34
|
+
- 7
|
35
|
+
- 5
|
30
36
|
version: 0.7.5
|
31
|
-
- !ruby/object:Gem::Dependency
|
32
|
-
name: rspec
|
33
|
-
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
|
-
requirements:
|
36
|
-
- - ! '>='
|
37
|
-
- !ruby/object:Gem::Version
|
38
|
-
version: 2.0.0
|
39
37
|
type: :development
|
38
|
+
version_requirements: *id001
|
39
|
+
- !ruby/object:Gem::Dependency
|
40
|
+
name: rspec
|
40
41
|
prerelease: false
|
41
|
-
|
42
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
42
43
|
none: false
|
43
|
-
requirements:
|
44
|
-
- -
|
45
|
-
- !ruby/object:Gem::Version
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
hash: 15
|
48
|
+
segments:
|
49
|
+
- 2
|
50
|
+
- 0
|
51
|
+
- 0
|
46
52
|
version: 2.0.0
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: chardet
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
|
-
requirements:
|
52
|
-
- - ! '>='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
53
|
type: :development
|
54
|
+
version_requirements: *id002
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: chardet
|
56
57
|
prerelease: false
|
57
|
-
|
58
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
58
59
|
none: false
|
59
|
-
requirements:
|
60
|
-
- -
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
hash: 3
|
64
|
+
segments:
|
65
|
+
- 0
|
66
|
+
version: "0"
|
67
|
+
type: :development
|
68
|
+
version_requirements: *id003
|
63
69
|
description:
|
64
70
|
email: seniorlopez@gmail.com
|
65
71
|
executables: []
|
66
|
-
|
72
|
+
|
73
|
+
extensions:
|
67
74
|
- ext/charlock_holmes/extconf.rb
|
68
75
|
extra_rdoc_files: []
|
69
|
-
|
76
|
+
|
77
|
+
files:
|
70
78
|
- .gitignore
|
71
79
|
- .rspec
|
72
80
|
- Gemfile
|
@@ -98,32 +106,41 @@ files:
|
|
98
106
|
- spec/fixtures/repl2.cljs
|
99
107
|
- spec/spec_helper.rb
|
100
108
|
- spec/string_method_spec.rb
|
109
|
+
has_rdoc: true
|
101
110
|
homepage: http://github.com/brianmario/charlock_holmes
|
102
111
|
licenses: []
|
112
|
+
|
103
113
|
post_install_message:
|
104
|
-
rdoc_options:
|
114
|
+
rdoc_options:
|
105
115
|
- --charset=UTF-8
|
106
|
-
require_paths:
|
116
|
+
require_paths:
|
107
117
|
- lib
|
108
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
109
119
|
none: false
|
110
|
-
requirements:
|
111
|
-
- -
|
112
|
-
- !ruby/object:Gem::Version
|
113
|
-
|
114
|
-
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
hash: 3
|
124
|
+
segments:
|
125
|
+
- 0
|
126
|
+
version: "0"
|
127
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
128
|
none: false
|
116
|
-
requirements:
|
117
|
-
- -
|
118
|
-
- !ruby/object:Gem::Version
|
119
|
-
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
hash: 3
|
133
|
+
segments:
|
134
|
+
- 0
|
135
|
+
version: "0"
|
120
136
|
requirements: []
|
137
|
+
|
121
138
|
rubyforge_project:
|
122
|
-
rubygems_version: 1.
|
139
|
+
rubygems_version: 1.6.2
|
123
140
|
signing_key:
|
124
141
|
specification_version: 3
|
125
142
|
summary: Character encoding detection, brought to you by ICU
|
126
|
-
test_files:
|
143
|
+
test_files:
|
127
144
|
- spec/converter_spec.rb
|
128
145
|
- spec/encoding_detector_spec.rb
|
129
146
|
- spec/fixtures/AnsiGraph.psm1
|