hippie_csv 0.0.3 → 0.0.4
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4c36e47f1db88a3f9f30eafc8eef194becb8ab7
|
4
|
+
data.tar.gz: 25f0273e07e06902e369a767b66afc149e554156
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23010d852b216afe652be53e65acb917ebfa020b118dd70cceeb48e13ef1831665bacad3fa17e89a87d1027ee66fc3e7394b16be57739492b468af0c9af600df
|
7
|
+
data.tar.gz: ce66e8cc0823906bb89dd04a111f53a17f92fa998156a4cdafb5a71534be0752f25e61c0a61186c9f1bb6c3815169e909da87b9a8266248edeb594dffdfb735a
|
data/hippie_csv.gemspec
CHANGED
data/lib/hippie_csv/support.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require "hippie_csv/constants"
|
2
|
-
require "
|
2
|
+
require "rchardet"
|
3
3
|
|
4
4
|
module HippieCSV
|
5
5
|
module Support
|
@@ -10,10 +10,10 @@ module HippieCSV
|
|
10
10
|
|
11
11
|
def encode(string)
|
12
12
|
unless string.valid_encoding?
|
13
|
-
current_encoding =
|
13
|
+
current_encoding = CharDet.detect(string)["encoding"]
|
14
14
|
|
15
15
|
string = if !current_encoding.nil?
|
16
|
-
|
16
|
+
string.encode(ENCODING, current_encoding)
|
17
17
|
else
|
18
18
|
string.encode(ALTERNATE_ENCODING, ENCODING, invalid: :replace, replace: "")
|
19
19
|
.encode(ENCODING, ALTERNATE_ENCODING)
|
data/lib/hippie_csv/version.rb
CHANGED
data/spec/hippie_csv_spec.rb
CHANGED
@@ -101,13 +101,13 @@ describe HippieCSV do
|
|
101
101
|
import = subject.read(path)
|
102
102
|
expect(import[0].count).to eq(9)
|
103
103
|
end
|
104
|
-
|
104
|
+
|
105
105
|
it "works for a hard case" do
|
106
106
|
path = fixture_path(:accents_semicolon_windows_1252)
|
107
107
|
|
108
108
|
import = subject.read(path)
|
109
109
|
expect(import[0][1]).to eq("Jérome")
|
110
|
-
expect(import[1][0]).to eq("
|
110
|
+
expect(import[1][0]).to eq("Héloise")
|
111
111
|
end
|
112
112
|
end
|
113
113
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hippie_csv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen O'Brien
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: rchardet
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - '>='
|