fech 1.4.2 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fech (1.4.2)
4
+ fech (1.4.3)
5
+ ensure-encoding
5
6
  fastercsv
6
7
  people
7
8
 
@@ -11,6 +12,7 @@ GEM
11
12
  archive-tar-minitar (0.5.2)
12
13
  columnize (0.3.6)
13
14
  diff-lcs (1.1.2)
15
+ ensure-encoding (0.1)
14
16
  fastercsv (1.5.5)
15
17
  linecache19 (0.5.12)
16
18
  ruby_core_source (>= 0.1.4)
data/fech.gemspec CHANGED
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
21
21
 
22
22
  s.add_dependency "fastercsv"
23
23
  s.add_dependency "people"
24
+ s.add_dependency "ensure-encoding"
24
25
  if RUBY_VERSION < "1.9"
25
26
  s.add_development_dependency "linecache", "0.43"
26
27
  s.add_development_dependency "ruby-debug"
data/lib/fech/filing.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'tmpdir'
2
2
  require 'open-uri'
3
+ require 'ensure/encoding'
3
4
 
4
5
  module Fech
5
6
 
@@ -34,7 +35,12 @@ module Fech
34
35
  # directory.
35
36
  def download
36
37
  File.open(file_path, 'w') do |file|
37
- file << open(filing_url).read
38
+ begin
39
+ file << open(filing_url).read
40
+ rescue
41
+ file << open(filing_url).read.ensure_encoding('UTF-8', :external_encoding => Encoding::UTF_8,
42
+ :invalid_characters => :drop)
43
+ end
38
44
  end
39
45
  self
40
46
  end
@@ -263,7 +269,7 @@ module Fech
263
269
  content = file_contents.read
264
270
 
265
271
  if RUBY_VERSION > "1.9.2"
266
- content.encode!('UTF-16', 'UTF-8', :invalid => :replace, :replace => '')
272
+ content.encode!('UTF-16', 'UTF-8', :invalid => :replace, :undef => :replace, :replace => '?')
267
273
  content.encode!('UTF-8', 'UTF-16')
268
274
  else
269
275
  require 'iconv'
data/lib/fech/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Fech
2
- VERSION = "1.4.2"
2
+ VERSION = "1.4.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fech
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.4.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2013-09-06 00:00:00.000000000 Z
15
+ date: 2013-09-10 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: fastercsv
@@ -46,6 +46,22 @@ dependencies:
46
46
  - - ! '>='
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
+ - !ruby/object:Gem::Dependency
50
+ name: ensure-encoding
51
+ requirement: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ type: :runtime
58
+ prerelease: false
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
49
65
  - !ruby/object:Gem::Dependency
50
66
  name: ruby-debug19
51
67
  requirement: !ruby/object:Gem::Requirement
@@ -321,7 +337,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
321
337
  version: '0'
322
338
  segments:
323
339
  - 0
324
- hash: 1746792798321377153
340
+ hash: -1385467787118064033
325
341
  required_rubygems_version: !ruby/object:Gem::Requirement
326
342
  none: false
327
343
  requirements:
@@ -330,7 +346,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
330
346
  version: '0'
331
347
  segments:
332
348
  - 0
333
- hash: 1746792798321377153
349
+ hash: -1385467787118064033
334
350
  requirements: []
335
351
  rubyforge_project: fech
336
352
  rubygems_version: 1.8.25