title: How to load a irregular csv file using Rust
body: <p>I would like to load the following csv file, which has a difference of notation rules between before 2nd line and after 3rd line.<br />
  <strong>test.csv</strong></p>
  <pre><code>[YEAR],2022,[Q],1,
  [TEST],mid-term,[GRADE],3,
  FirstName,LastName,Score,
  AA,aaa,97,
  BB,bbbb,15,
  CC,cccc,66,
  DD,ddd,73,
  EE,eeeee,42,
  FF,fffff,52,
  GG,ggg,64,
  HH,h,86,
  II,iii,88,
  JJ,jjjj,72,
  </code></pre>
  <p>However, I have the following error. I think this error is caused by the difference of notation rules. How do I correct this error and load the csv file as I want.<br />
  <strong>error message</strong></p>
  <pre><code>StringRecord([&quot;[YEAR]&quot;, &quot;2022&quot;, &quot;[Q]&quot;, &quot;1&quot;, &quot;&quot;])
  StringRecord([&quot;[TEST]&quot;, &quot;mid-term&quot;, &quot;[GRADE]&quot;, &quot;3&quot;, &quot;&quot;])
  Error: Error(UnequalLengths { pos: Some(Position { byte: 47, line: 2, record: 2 }), expected_len: 5, len: 4 })
  error: process didn't exit successfully: `target\debug\read_csv.exe` (exit code: 1)
  </code></pre>
  <p><strong>main.rs</strong></p>
  <pre><code>use csv::Error;
  use csv::ReaderBuilder;
  use encoding_rs;
  use std::fs;
  
  fn main() -&gt; Result&lt;(), Error&gt; {
      let path = &quot;./test.csv&quot;;
      let file = fs::read(path).unwrap();
      let (res, _, _) = encoding_rs::SHIFT_JIS.decode(&amp;file);
  
      let mut reader = ReaderBuilder::new()
          .has_headers(false)
          .from_reader(res.as_bytes());
  
      for result in reader.records() {
          let record = result?;
          println!(&quot;{:?}&quot;, record)
      }
  
      Ok(())
  }
  </code></pre>
  <p><strong>Version</strong></p>
  <pre><code>cargo = &quot;1.62.0&quot;
  rustc = &quot;1.62.0&quot;
  csv = &quot;1.1.6&quot;
  encoding_rs = &quot;0.8.31&quot;
  </code></pre>