nesquikcsv 0.1.0 → 0.1.1

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: 77bd305b5beeb6d2d9c5aa453d46f1eacce9f930
4
- data.tar.gz: 23a2e272068835c70087cfeb4fa9a7aaa28e4c26
3
+ metadata.gz: a8e84b01e1c81cf63e27c87bc0f37225431dcfbe
4
+ data.tar.gz: 685ca38bd86618cf1cf896f726c02c1757398a61
5
5
  SHA512:
6
- metadata.gz: ca390b23677ba83564fcccd47c4a339f5b8372da9bd6b69f1824509917becc9f189f60829bcca11935f7a3c7a886ae7eec7f48bcc99907d1930e8451ce8b23bb
7
- data.tar.gz: f9f44de8d2b0b07d3cc38e9bd82f09c384cfa9947d87adfae976ba4aeb88442f0d368935e9d8092ba36f352373732ed7997599c87f7e1023255ad5ef6823b7db
6
+ metadata.gz: c04fe921fb15442cc727ad15354a48dc55e63b27ce04cd553e31e54e50c299bec08bb2ebdb2cf11659ff5183a19a50be3c3b1d0df3db1ca5a2ed3e229d45a97d
7
+ data.tar.gz: 50ce1b7cd325b7397b88189367172e1d59fe338a5ba6f1ba34d93e6f27443ebf0a9a30aeaf2b17f41ebec20fcba3ca9a353ba50ff7b09e132b61edf31c35b467
@@ -47,14 +47,14 @@ static VALUE parse_line(VALUE self, VALUE str, VALUE encoding)
47
47
  {
48
48
  case ',':
49
49
  if (state == UNQUOTED) {
50
- rb_ary_push(array, (index == 0 ? Qnil: rb_str_new(value, index)));
50
+ rb_ary_push(array, (index == 0 ? Qnil: rb_enc_str_new(value, index, rb_encoding)));
51
51
  index = 0;
52
52
  }
53
53
  else if (state == IN_QUOTED) {
54
54
  value[index++] = c;
55
55
  }
56
56
  else if (state == QUOTE_IN_QUOTED) {
57
- rb_ary_push(array, rb_str_new(value, index));
57
+ rb_ary_push(array, rb_enc_str_new(value, index, rb_encoding));
58
58
  index = 0;
59
59
  state = UNQUOTED;
60
60
  }
data/lib/csv_parser.so CHANGED
Binary file
@@ -1,3 +1,3 @@
1
1
  class NesquikCSV
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/nesquikcsv.rb CHANGED
@@ -54,7 +54,8 @@ class NesquikCSV
54
54
  end
55
55
 
56
56
  def self.parse_line(line, encoding)
57
- CsvParser.parse_line(line, encoding)
57
+ r = CsvParser.parse_line(line, encoding)
58
+ r.map {|e| e.force_encoding(encoding) unless e.nil?} unless r.nil?
58
59
  end
59
60
 
60
61
  # Create new NesquikCSV wrapping the specified IO object
@@ -1,3 +1,4 @@
1
+ # encoding: UTF-8
1
2
  #
2
3
  # Tests copied from faster_csv by James Edward Gray II
3
4
  #
@@ -123,4 +124,8 @@ class TestCSVParsing < Test::Unit::TestCase
123
124
  end
124
125
  end
125
126
 
127
+ def test_encoding
128
+ assert_equal(["ñ","ó","¸"], CsvParser.parse_line("ñ,ó,¸", "UTF-8"))
129
+ end
130
+
126
131
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nesquikcsv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Martty