Parsing a Custom CSV with Embedded Quotes in Ruby - field configuration Splitting
I'm trying to configure I'm building a feature where I am working on parsing a custom CSV file in Ruby where some fields are enclosed in double quotes, and these fields may contain commas as well as embedded quotes. For example, a line in the CSV may look like this: ```csv "Name, with, commas", "Some ""quoted"" text", 42 ``` I am using the built-in `CSV` library, but I am struggling with properly handling the embedded quotes. When I try to parse the above line, it splits the fields incorrectly, leading to unexpected results. Hereβs a snippet of my code: ```ruby require 'csv' csv_data = <<~DATA "Name, with, commas", "Some ""quoted"" text", 42 DATA parsed_data = CSV.parse(csv_data, quote_char: '"') puts parsed_data.inspect ``` I expected to see an array with three elements, but instead, I'm getting this unexpected output: ``` ["Name, with, commas", "Some ", "text", "42"] ``` It seems like the embedded quotes are causing the library to misinterpret the fields. I tried using different options with `CSV.parse`, like `:liberal_parsing => true`, but that didn't resolve the scenario. Does anyone know how to correctly parse this format while ensuring that embedded quotes are handled properly? Any insight or suggestions on adjustments to make would be greatly appreciated! Thanks, I really appreciate it! Thanks for any help you can provide!