[#97086] [Ruby master Bug#16612] Enumerator::ArithmeticSequence#last with float range produces incorrect value — muraken@...
Issue #16612 has been updated by mrkn (Kenta Murata).
4 messages
2020/02/07
[#97307] [Ruby master Feature#16663] Add block or filtered forms of Kernel#caller to allow early bail-out — headius@...
Issue #16663 has been reported by headius (Charles Nutter).
29 messages
2020/02/28
[ruby-core:97132] [Ruby master Bug#16628] CSV.new する時にGzipReaderを渡すとCSV::Parser::InvalidEncodingが出る場合がある
From:
namayaki3@...
Date:
2020-02-12 01:31:07 UTC
List:
ruby-core #97132
Issue #16628 has been reported by namayaki3 (山中 裕樹).
----------------------------------------
Bug #16628: CSV.new する時にGzipReaderを渡すとCSV::Parser::InvalidEncodingが出る場合がある
https://bugs.ruby-lang.org/issues/16628
* Author: namayaki3 (山中 裕樹)
* Status: Open
* Priority: Normal
* ruby -v: 2.6.5
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
## バージョン
ruby 2.6.5
## 現象
以下のようにCSV.newする時にGZipReaderを渡すとCSV::Parser::InvalidEncodingが出てエラーになります。
### コード
```
gz = Zlib::GzipReader.new(File.open("file/to/path")
CSV.new(gz).each_with_index do |d,i|
~~~ 略 ~~~~
end
```
### エラーログ
```
.rbenv/versions/2.6.5/lib/ruby/2.6.0/csv/parser.rb:314:in `rescue in parse': Invalid byte sequence in UTF-8 in line 78512. (CSV::MalformedCSVError)
```
## 考えられる要因
csv/parser.rb の202行目でinput.getsする時にchunksizeを指定していますが、この値によって、chunkが変なところで切られているように見えます。
それによって、utf8のバリデーションが失敗し、上記エラーが出ているように見えます。
ruby 2.5系では発生しません。
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>