CSV parser fails with mixed quoting and non-standard row_sep
還沒有人認領這個 Issue。
評估
研究方向
首先使用 row_sep: "|\n" 透過 CSV.generate 和 CSV.parse 重現該範例,然後將加引號和未加引號的列與成功的案例進行比較。追蹤剖析器如何處理列分隔符號和欄位引號;完成的條件是混合引號輸入能在不出現 CSV::MalformedCSVError 的情況下完成剖析,同時現有替代方案仍然有效。
由索引模型根據 Issue 內容生成。
描述
opts = {row_sep: "|\n", col_sep: ","}
CSV.parse(CSV.generate(opts) { |csv|
csv << ["yes, it's true"];
csv << [ "CSV is broken"];
csv << ["uhoh!"]; }, opts)
In the example above, the parser will raise a CSV::MalformedCSVError (Unquoted fields do not allow new line <"\n"> in line 2.) error.
It will succeed if any of the following are done:
- pass
force_quotes: truetogenerate - add a comma in each row
- remove the comma from the first row
- use
row_sep: "\n"
Therefore, the problem seems to be that a non-standard row_sep + lines with a field being quoted in one row and unquoted in the next.
- 主要語言
- Ruby
- 星號
- 220
- 分支
- 139
- 平均合併
- 1 天 1 小時
- 30 天內合併 PR
- 2
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
ruby/csv 的其他 Issue
-
Unknown converter name is silently accepted and later fails with "undefined method 'arity' for nil"未關閉
難度 2/5 1-3 小時 新手友好度 57/100
-
難度 3/5 1-2 天 新手友好度 68/100
-
Timeout on Windows可能重新可做 @kou 於 406 天前認領,目前沒有進行中的 PR。 未關閉
-
難度 4/5 3-5 天 新手友好度 35/100
-
難度 4/5 3-5 天 新手友好度 25/100
相似的 Issue
-
🐛 bug 👩💻 équipe CE 🧑🏭 entreprises
難度 2/5 1-3 小時 新手友好度 76/100
betagouv/conseillers-entreprises#4808 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 76/100
yosiat/panko_serializer#250 ·
-
難度 1/5 1 小時以內 新手友好度 75/100
cline/mcp-marketplace#3886 ·
-
難度 2/5 1-3 小時 新手友好度 78/100