rchardet 1.4.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9b7b0239f3a6b2da6b3e5e71d45e475bbc31b492
4
+ data.tar.gz: 43a81fec90be4210c38bd5ec56b3a5b4c7ca4b54
5
+ SHA512:
6
+ metadata.gz: c64b08ebadc55395308c7019c181a57479e0b9f06f23a2a347d4e507a94ff84937fb3e36e31095466d9323952ed3f8297a26d8ec69230f36bdad92ec68ceb63a
7
+ data.tar.gz: 7a512d57491f7ad910269c8ed8962d4f407b2a1af037a691aa12461b3bbfa6bf7b6dec26fc49e892357678feed2aa5997475e48def361638770dafb36e57731e
data/lib/rchardet.rb CHANGED
@@ -56,6 +56,8 @@ require 'rchardet/utf8prober'
56
56
 
57
57
  module CharDet
58
58
  def CharDet.detect(aBuf)
59
+ aBuf = aBuf.dup.force_encoding(Encoding::BINARY) unless aBuf.valid_encoding?
60
+
59
61
  u = UniversalDetector.new
60
62
  u.reset
61
63
  u.feed(aBuf)
@@ -14,12 +14,12 @@
14
14
  # modify it under the terms of the GNU Lesser General Public
15
15
  # License as published by the Free Software Foundation; either
16
16
  # version 2.1 of the License, or (at your option) any later version.
17
- #
17
+ #
18
18
  # This library is distributed in the hope that it will be useful,
19
19
  # but WITHOUT ANY WARRANTY; without even the implied warranty of
20
20
  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21
21
  # Lesser General Public License for more details.
22
- #
22
+ #
23
23
  # You should have received a copy of the GNU Lesser General Public
24
24
  # License along with this library; if not, write to the Free Software
25
25
  # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
@@ -137,9 +137,9 @@ module CharDet
137
137
  return if @done
138
138
 
139
139
  # The buffer we got is byte oriented, and a character may span in more than one
140
- # buffers. In case the last one or two byte in last buffer is not complete, we
140
+ # buffers. In case the last one or two byte in last buffer is not complete, we
141
141
  # record how many byte needed to complete that character and skip these bytes here.
142
- # We can choose to record those bytes as well and analyse the character once it
142
+ # We can choose to record those bytes as well and analyse the character once it
143
143
  # is complete, but since a character will not make much difference, by simply skipping
144
144
  # this character will simply our logic and improve performance.
145
145
  i = @needToSkipCharNum
@@ -198,7 +198,7 @@ module CharDet
198
198
  return aStr[1].ord - 0x9F, charLen
199
199
  end
200
200
  end
201
-
201
+
202
202
  return -1, charLen
203
203
  end
204
204
  end
@@ -1,3 +1,3 @@
1
1
  module CharDet
2
- VERSION = "1.4.1"
2
+ VERSION = "1.4.2"
3
3
  end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rchardet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
5
- prerelease:
4
+ version: 1.4.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Michael Grosser
@@ -10,7 +9,7 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2014-08-27 00:00:00.000000000 Z
12
+ date: 2014-08-28 00:00:00.000000000 Z
14
13
  dependencies: []
15
14
  description:
16
15
  email:
@@ -20,6 +19,7 @@ executables: []
20
19
  extensions: []
21
20
  extra_rdoc_files: []
22
21
  files:
22
+ - lib/rchardet.rb
23
23
  - lib/rchardet/big5freq.rb
24
24
  - lib/rchardet/big5prober.rb
25
25
  - lib/rchardet/chardistribution.rb
@@ -55,31 +55,29 @@ files:
55
55
  - lib/rchardet/universaldetector.rb
56
56
  - lib/rchardet/utf8prober.rb
57
57
  - lib/rchardet/version.rb
58
- - lib/rchardet.rb
59
58
  homepage: https://github.com/jmhodges/rchardet
60
59
  licenses:
61
60
  - LGPL
61
+ metadata: {}
62
62
  post_install_message:
63
63
  rdoc_options: []
64
64
  require_paths:
65
65
  - lib
66
66
  required_ruby_version: !ruby/object:Gem::Requirement
67
- none: false
68
67
  requirements:
69
- - - ! '>='
68
+ - - ">="
70
69
  - !ruby/object:Gem::Version
71
70
  version: 1.9.3
72
71
  required_rubygems_version: !ruby/object:Gem::Requirement
73
- none: false
74
72
  requirements:
75
- - - ! '>='
73
+ - - ">="
76
74
  - !ruby/object:Gem::Version
77
75
  version: '0'
78
76
  requirements: []
79
77
  rubyforge_project:
80
- rubygems_version: 1.8.23
78
+ rubygems_version: 2.2.2
81
79
  signing_key:
82
- specification_version: 3
80
+ specification_version: 4
83
81
  summary: Character encoding auto-detection in Ruby. As smart as your browser. Open
84
82
  source.
85
83
  test_files: []