Unicode CSV API

I need a C API to manage CSV data that can work with unicode. I am aware of libcsv (sourceforge.net/projects/libcsv), but I donโ€™t think this will work for unicode (please correct me if I am wrong), because I do not see wchar_t being used.

Please inform.

+1
source share
1 answer

It seems that libcsv does not use the C line functions to do its job, so it almost works out of the box, despite its ignorance of mbcs / ws. It treats the string as an array of bytes with an explicit length. This can basically work for certain wide-character encodings that upload ASCII bytes to fill the width (so a new line can be encoded as "\ 0 \ n" and the space as "\ 0"). You can also encode your wide data as UTF-8, which should make things a little easier. But both approaches can be based on how libcsv identifies space and line terminator markers: it expects you to say it byte-byte, regardless of whether it looks at a space or terminator, which does not allow multibyte spatial / terminal encodings You can fix it,changing the library to pass the pointer to the string and the length remaining in the string to its space / term check functions, which would be pretty simple.

0

Source: https://habr.com/ru/post/1533637/


All Articles