@SGaist
How did you implement it in the end ?
I'm still working on it. :)
The app is kind of a toolkit for inspecting CSV files and correcting them to a limited extent, if necessary. These files can come from anywhere, and often the consumer of a CSV file doesn't have any control over the process which creates them. What it is supposed to do is the following:
Determine the text encoding used, either semi-automatically (if Unicode is used, this can be 100% automatic) or by letting the user choose, or for unknown 8-bit encodings iconv, uchardet or icu can be used if the support is installed;
If the encoding cannot be determined, the file is rejected, or else the user can try different encodings. This is where the control characters can be displayed;
As to how I am implementing this internally, a copy of the text from the file is made, converting it to QString and using QTextEdit to display it. All of the special control characters can either be displayed or hidden depending on the user's preference; also the highlighting (colors, etc.) is user-configurable;
The delimiter token and quote character can be automatically determined through heuristics, or the user can override these to something else;
There is a limited amount of support for comments and metadata at the beginning of a file. The user can add or remove these, and the file can be saved without the extra metadata, and/or in a different encoding, lie endings, etc.
Since I don't want to turn this into a full-fledged text editor, the app will just print out a report if the CSV file is not acceptably formatted, indicating the location of invalid characters, and the user can correct this in some other application. When importing CSV data into a database, for example, often the import will fail without giving enough diagnostic information as to where the failure occurred. This app should be helpful in that respect.