<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/test/csv/parse/test_strip.rb, branch v3_3_11</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>[ruby/csv] Add handling for ambiguous parsing options (https://github.com/ruby/csv/pull/226)</title>
<updated>2021-12-24T05:35:33+00:00</updated>
<author>
<name>adamroyjones</name>
<email>10088591+adamroyjones@users.noreply.github.com</email>
</author>
<published>2021-11-18T21:20:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=c70dc3cafb29d89d0377677ead346495183db47e'/>
<id>c70dc3cafb29d89d0377677ead346495183db47e</id>
<content type='text'>
GitHub: fix GH-225

With Ruby 3.0.2 and csv 3.2.1, the file

```ruby
require "csv"
File.open("example.tsv", "w") { |f| f.puts("foo\t\tbar") }
CSV.read("example.tsv", col_sep: "\t", strip: true)
```

produces the error

```
lib/csv/parser.rb:935:in `parse_quotable_robust': TODO: Meaningful
message in line 1. (CSV::MalformedCSVError)
```

However, the CSV in this example is not malformed; instead, ambiguous
options were provided to the parser. It is not obvious (to me) whether
the string should be parsed as

- `["foo\t\tbar"]`,
- `["foo", "bar"]`,
- `["foo", "", "bar"]`, or
- `["foo", nil, "bar"]`.

This commit adds code that raises an exception when this situation is
encountered. Specifically, it checks if the column separator either ends
with or starts with the characters that would be stripped away.

This commit also adds unit tests and updates the documentation.

https://github.com/ruby/csv/commit/cc317dd42d
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
GitHub: fix GH-225

With Ruby 3.0.2 and csv 3.2.1, the file

```ruby
require "csv"
File.open("example.tsv", "w") { |f| f.puts("foo\t\tbar") }
CSV.read("example.tsv", col_sep: "\t", strip: true)
```

produces the error

```
lib/csv/parser.rb:935:in `parse_quotable_robust': TODO: Meaningful
message in line 1. (CSV::MalformedCSVError)
```

However, the CSV in this example is not malformed; instead, ambiguous
options were provided to the parser. It is not obvious (to me) whether
the string should be parsed as

- `["foo\t\tbar"]`,
- `["foo", "bar"]`,
- `["foo", "", "bar"]`, or
- `["foo", nil, "bar"]`.

This commit adds code that raises an exception when this situation is
encountered. Specifically, it checks if the column separator either ends
with or starts with the characters that would be stripped away.

This commit also adds unit tests and updates the documentation.

https://github.com/ruby/csv/commit/cc317dd42d
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/csv] Fix a parse bug when split character exists in middle of column value</title>
<updated>2020-07-19T17:32:49+00:00</updated>
<author>
<name>Sutou Kouhei</name>
<email>kou@clear-code.com</email>
</author>
<published>2019-12-24T21:59:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=814bfc8adc128ed050f2b60a423beb86e00fc6ec'/>
<id>814bfc8adc128ed050f2b60a423beb86e00fc6ec</id>
<content type='text'>
GitHub: fix #115

Reported by TOMITA Masahiro. Thanks!!!

https://github.com/ruby/csv/commit/398b3564c5
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
GitHub: fix #115

Reported by TOMITA Masahiro. Thanks!!!

https://github.com/ruby/csv/commit/398b3564c5
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/csv] Fix a bug that strip: true removes newlines</title>
<updated>2019-07-14T14:07:31+00:00</updated>
<author>
<name>Kouhei Sutou</name>
<email>kou@clear-code.com</email>
</author>
<published>2019-04-22T20:54:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=198281a71d95c1a48445dc6e913bc1bd62350054'/>
<id>198281a71d95c1a48445dc6e913bc1bd62350054</id>
<content type='text'>
https://github.com/ruby/csv/commit/5540d35a30
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://github.com/ruby/csv/commit/5540d35a30
</pre>
</div>
</content>
</entry>
<entry>
<title>Import CSV 3.0.8</title>
<updated>2019-04-14T21:01:51+00:00</updated>
<author>
<name>kou</name>
<email>kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2019-04-14T21:01:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=e3b6c7c7ebca1b051dbaa6f33494e92f5638fcc9'/>
<id>e3b6c7c7ebca1b051dbaa6f33494e92f5638fcc9</id>
<content type='text'>
This includes performance improvements and backward incompatibility
fixes.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This includes performance improvements and backward incompatibility
fixes.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
</feed>
