epub_book 0.1.24 → 0.1.27

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b9ac65a058cdf7b53e8b45e94a46a96fd60d41a554565c085adbb8b97a86f12d
4
- data.tar.gz: 660f5dbc39901304ab576d6a0dd2fcfd1071c1bcd648531ca1d4da38ce18ef34
3
+ metadata.gz: a433512f6b0c69b388fd5071ef442edf6e07aa0755872a61f9a03896f7dd354b
4
+ data.tar.gz: 6ffb8b8863f2670bc07718f98bacba13be44faab8c775737777403944f7fae5c
5
5
  SHA512:
6
- metadata.gz: 3d4f021a6326c17c1ca3a1e6df6c9ce146486142b12217b687bd67c67d3bb10e3cdadc9740d4073e559ca35817b7078622ee6cd634b2c5ece6cb5f3c90b31e49
7
- data.tar.gz: 708a9cd652f79ee677914573f45a8f52f308141164c2c818df13b896949ae95e83de6dc2123e56ff118f144449cd5af6a59f6bf89b69ac61b8fcee2e689aa0be
6
+ metadata.gz: 13097be5e90b59a7c3d02cdb1a8eb12bf05afa01739523a279893e7c34ed44935f930064f518010fa80223db982ace912aacfbfe1c786a0ddbbf36843d0565e1
7
+ data.tar.gz: 0b158bd9956551cccea116ff4fa60a0455de9d2ebd2753446af102228e4693cb5e5ad5903aab9bdd157274a7bb4ad3ad631814dc885396268c3b5ebc3654d06e
@@ -224,8 +224,10 @@ module EpubBook
224
224
  #is valid encoding
225
225
  def judge_encoding(str)
226
226
  EpubBook.logger.info str.encoding
227
- /<meta.*?charset\s*=[\s\"\']?utf-8/i =~ str ? str : str.force_encoding('gbk').encode!('utf-8',invalid: :replace, undef: :replace)
228
- str.scrub! unless str.valid_encoding?
227
+ #/<meta.*?charset\s*=[\s\"\']?utf-8/i =~ str ? str : str.force_encoding('gbk').encode!('utf-8',invalid: :replace, undef: :replace)
228
+
229
+ str.scrub!('') unless str.valid_encoding?
230
+ str.encode!('utf-8', invalid: :replace, undef: :replace, replace: '------') if str.encoding.name != 'UTF-8'
229
231
 
230
232
  EpubBook.logger.info "-------encode 后 #{str.encoding}"
231
233
  str
@@ -1,3 +1,3 @@
1
1
  module EpubBook
2
- VERSION = "0.1.24"
2
+ VERSION = "0.1.27"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epub_book
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.24
4
+ version: 0.1.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - qmliu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-01 00:00:00.000000000 Z
11
+ date: 2022-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http