ben-strasser / fast-cpp-csv-parser

fast-cpp-csv-parser
BSD 3-Clause "New" or "Revised" License
2.09k stars 435 forks source link

Encode conversion support #130

Closed lymslive closed 2 years ago

lymslive commented 2 years ago
  1. convert encode using iconv lib, but only in linux
  2. unit test
  3. minor fix csv.h without change the layout of Reader classes.
ben-strasser commented 2 years ago

Thank you for the PR. However, I do not want to merge PRs that introduce new dependencies. That will break too many existing users.

I also do not really understand what you are trying to do. Apparently, you have files in GBK and EUC-JP encoding and want to read these. According to Wikipedia, they consistent with the 7 bit ASCII values. This means that to the best of my understanding

int main(){
  io::CSVReader<3> in("ram.csv");
  in.read_header(io::ignore_extra_column, "vendor", "size", "speed");
  char* encoded_vendor; int size; double speed;
  while(in.read_row(encoded_vendor, size, speed)){
    // vendor is GBK/EUC-JP encoded
    std::string vendor = my_decode(encoded_vector);
  }
}

should just work.