spurious error message when using qsv header #837
-
I'm on windows 7 and getting this "error"
Am I using hugely impressive program btw. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Rust's String type requires UTF-8 encoding, and since CSV files are Text Files that are primarily processed as Strings, they need to be UTF-8 encoded. This is typically not a problem with other operating systems because UTF-8 is the de facto encoding standard. Unfortunately, Window's default encoding is UTF-16LE, which presents a problems when you redirect/pipe qsv's output, as anytime you do so, the Windows operating system changes the encoding to UTF-16LE. Ironically, even Microsoft's own Excel cannot properly open a UTF-16LE encoded CSV file. Regardless, the easiest way around this limitation is to use qsv's qsv excel -s 0 random.xlsx --output random.csv
qsv headers random.csv Having said that, qsv is actually quite tolerant of non UTF-8 encoded files as it often uses csv::ByteRecords when reading CSV files, handling the input as raw bytes ( If you need to stay on Windows 7 and want to use piping and redirection with qsv to take advantage of its command line composability, you may want to install an alternative Command Line Interface (CLI) environment like Cygwin. It allows you to get that Linux feeling (and more importantly, its default UTF8-encoding!) - on Windows 😄 You can just use Cygwin as your "qsv command-line environment" - no need to install any extra packages beyond And I'm glad you find it impressive. Most qsv users are on Linux and Mac, and I only do testing on Windows 11. I'm actually quite surprised it still runs on Windows 7! The spurious message you're seeing may even be partly because of that... as qsv is built on all the latest stuff - for Rust (1.67.1) and all its crate dependencies since Windows 7 is EOLed and even the extended security updates have finally ended after being extended several times. I hope you're not browsing the web using it... 😅 |
Beta Was this translation helpful? Give feedback.
-
windows 7 / gitbash combo works without complaint. |
Beta Was this translation helpful? Give feedback.
Rust's String type requires UTF-8 encoding, and since CSV files are Text Files that are primarily processed as Strings, they need to be UTF-8 encoded.
This is typically not a problem with other operating systems because UTF-8 is the de facto encoding standard.
Unfortunately, Window's default encoding is UTF-16LE, which presents a problems when you redirect/pipe qsv's output, as anytime you do so, the Windows operating system changes the encoding to UTF-16LE. Ironically, even Microsoft's own Excel cannot properly open a UTF-16LE encoded CSV file.
Regardless, the easiest way around this limitation is to use qsv's
--output
option which creates a UTF-8 encoded file and refrain from piping/red…