vincentlaucsb / csv-parser

A high-performance, fully-featured CSV parser and serializer for modern C++.
MIT License
864 stars 144 forks source link

csv-writer problem? #224

Closed dangdkhanh closed 1 month ago

dangdkhanh commented 3 months ago

Hi,

std::ofstream infile;
infile.open(f, std::ios::out | std::ios::trunc);
auto writer = make_tsv_writer(infile);

I used to csvwriter to write the following lines writer << vec;

A.  887CE64AE586C40550C65DEE765EE3A6
B.  C9CD937BF0318C2309DF1CE6AA93142D
C.  2BAEB38E26F2AFB093F0D5AC6CF224AD
D.  470A32CCE2760A42F4C5ECB3D57186E5
E.  6E2E630653E45422A3C9809994EB313E

then I get this output image

but if I remove a dot behind A, the result is returned as expected:

A   887CE64AE586C40550C65DEE765EE3A6
B.  C9CD937BF0318C2309DF1CE6AA93142D
C.  2BAEB38E26F2AFB093F0D5AC6CF224AD
D.  470A32CCE2760A42F4C5ECB3D57186E5
E.  6E2E630653E45422A3C9809994EB313E

image

Is there any problem?

vincentlaucsb commented 1 month ago

Looks like a problem with whatever you are using to read the file (Notepad?) and not the library. The CSV writing code is very simple (joining items with the delimiter) and it's hard to see how random Chinese characters could result from just ASCII input.

image