cchardet 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +60 -11
- data/cchardet.gemspec +3 -3
- data/lib/cchardet/version.rb +1 -1
- metadata +12 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15c796c93834634e0aa4c71da57950fc7a42d43a3a28766d43fd7cf7103936a5
|
4
|
+
data.tar.gz: 581baba4d7dc98eb5720933125fdcb47c24272456fbe5cfb3a8b609c42916d0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e40197160218e7893d5250cd2c6504d8cbd128d4ff8ade21c0621d80a3faa6498070285dbfa4247363c63a7b66252fcc5c0b06bba86cf669af9937337444f4f
|
7
|
+
data.tar.gz: c66c7db53e896f9b609477fed8f67038c9a9143442e563bd79b3ac1ab8fa1cefff709b1c2fd988f098ae853ad246c755402529d9833ee7f8ada8abd2f27f909b
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,35 +1,84 @@
|
|
1
|
-
#
|
1
|
+
# cchardet
|
2
2
|
|
3
|
-
|
3
|
+
Ruby bindings for freedesktop.org's uchardet (<https://gitlab.freedesktop.org/uchardet/uchardet>).
|
4
4
|
|
5
|
-
|
5
|
+
By default, this gem depends on the system uchardet. Alternatively, it can build
|
6
|
+
the unreleased `wip/Jehan/improved-API` branch of uchardet as a native extension.
|
7
|
+
Note that uchardet's license terms may differ from those of this gem.
|
6
8
|
|
7
9
|
## Installation
|
8
10
|
|
11
|
+
### System uchardet
|
12
|
+
|
9
13
|
Add this line to your application's Gemfile:
|
10
14
|
|
11
15
|
```ruby
|
12
|
-
gem
|
16
|
+
gem "cchardet"
|
13
17
|
```
|
14
18
|
|
15
19
|
And then execute:
|
16
20
|
|
17
|
-
|
21
|
+
```
|
22
|
+
bundle install
|
23
|
+
```
|
18
24
|
|
19
25
|
Or install it yourself as:
|
20
26
|
|
21
|
-
|
27
|
+
```
|
28
|
+
gem install cchardet
|
29
|
+
```
|
30
|
+
|
31
|
+
### Unreleased branch as native extension
|
32
|
+
|
33
|
+
When using bundler:
|
34
|
+
|
35
|
+
```
|
36
|
+
bundle config set --global build.cchardet --with-unreleased-uchardet
|
37
|
+
bundle install
|
38
|
+
```
|
39
|
+
|
40
|
+
When using gem directly:
|
41
|
+
|
42
|
+
```
|
43
|
+
gem install cchardet -- --with-unreleased-uchardet
|
44
|
+
```
|
22
45
|
|
23
46
|
## Usage
|
24
47
|
|
25
|
-
|
48
|
+
```ruby
|
49
|
+
require "cchardet"
|
50
|
+
|
51
|
+
# ...
|
52
|
+
|
53
|
+
CChardet.detect(unknown_bytes)
|
54
|
+
# released uchardet:
|
55
|
+
# { encoding: "UTF-8" }
|
56
|
+
# unreleased native extension:
|
57
|
+
# { encoding: "UTF-8", confidence: 1.0, language: nil }
|
58
|
+
```
|
26
59
|
|
27
|
-
|
60
|
+
The only public interface is `CChardet.detect`, which takes a sequence of bytes.
|
28
61
|
|
29
|
-
|
62
|
+
When using a released version of uchardet, it will return a hash with a single
|
63
|
+
element, `encoding`, indicating the detected encoding of the byte stream. Future
|
64
|
+
versions of uchardet are likely to provide additional fields (see <https://gitlab.freedesktop.org/uchardet/uchardet/-/issues/5#note_474963>).
|
30
65
|
|
31
|
-
|
66
|
+
When using the unreleased native extension, it will return an array of hashes
|
67
|
+
having three elements:
|
68
|
+
|
69
|
+
- `encoding` – Detected encoding of the byte stream
|
70
|
+
- `confidence` – Confidence of the encoding value
|
71
|
+
- `language` – Detected language, if known
|
72
|
+
|
73
|
+
The hashes are ordered by descending confidence.
|
32
74
|
|
33
75
|
## Contributing
|
34
76
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
77
|
+
Bug reports and pull requests are welcome on GitHub at <https://github.com/elebow/cchardet>.
|
78
|
+
|
79
|
+
## License
|
80
|
+
|
81
|
+
MIT License.
|
82
|
+
|
83
|
+
Note that uchardet, which may be compiled as a native extension, is covered by its
|
84
|
+
own license.
|
data/cchardet.gemspec
CHANGED
@@ -9,12 +9,12 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.email = ["elebow@users.noreply.github.com"]
|
10
10
|
|
11
11
|
spec.summary = "Ruby bindings for freedesktop.org's libuchardet, for encoding detection."
|
12
|
-
spec.homepage = "https://github.com/elebow/cchardet"
|
13
|
-
spec.license = "
|
12
|
+
spec.homepage = "https://github.com/elebow/cchardet-ruby"
|
13
|
+
spec.license = "MIT"
|
14
14
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
15
15
|
|
16
16
|
spec.metadata["homepage_uri"] = spec.homepage
|
17
|
-
spec.metadata["source_code_uri"] = "https://github.com/elebow/cchardet"
|
17
|
+
spec.metadata["source_code_uri"] = "https://github.com/elebow/cchardet-ruby"
|
18
18
|
spec.metadata["changelog_uri"] = "https://github.com/elebow/cchardet/blob/trunk/CHANGELOG.md"
|
19
19
|
|
20
20
|
# Specify which files should be added to the gem when it is released.
|
data/lib/cchardet/version.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cchardet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eddie Lebow
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
13
|
+
description:
|
14
14
|
email:
|
15
15
|
- elebow@users.noreply.github.com
|
16
16
|
executables: []
|
@@ -333,14 +333,14 @@ files:
|
|
333
333
|
- lib/cchardet.rb
|
334
334
|
- lib/cchardet/lib_finder.rb
|
335
335
|
- lib/cchardet/version.rb
|
336
|
-
homepage: https://github.com/elebow/cchardet
|
336
|
+
homepage: https://github.com/elebow/cchardet-ruby
|
337
337
|
licenses:
|
338
|
-
-
|
338
|
+
- MIT
|
339
339
|
metadata:
|
340
|
-
homepage_uri: https://github.com/elebow/cchardet
|
341
|
-
source_code_uri: https://github.com/elebow/cchardet
|
340
|
+
homepage_uri: https://github.com/elebow/cchardet-ruby
|
341
|
+
source_code_uri: https://github.com/elebow/cchardet-ruby
|
342
342
|
changelog_uri: https://github.com/elebow/cchardet/blob/trunk/CHANGELOG.md
|
343
|
-
post_install_message:
|
343
|
+
post_install_message:
|
344
344
|
rdoc_options: []
|
345
345
|
require_paths:
|
346
346
|
- lib
|
@@ -355,8 +355,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
355
355
|
- !ruby/object:Gem::Version
|
356
356
|
version: '0'
|
357
357
|
requirements: []
|
358
|
-
|
359
|
-
|
358
|
+
rubyforge_project:
|
359
|
+
rubygems_version: 2.7.6.2
|
360
|
+
signing_key:
|
360
361
|
specification_version: 4
|
361
362
|
summary: Ruby bindings for freedesktop.org's libuchardet, for encoding detection.
|
362
363
|
test_files: []
|