Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve binary detection for cases starting by chance by a BOM
The presence of a sequence of bytes resembling a BOM does not guarantee that the data is text. We can in those cases use the detection provided by Qt. If the codec matches the one selected, we can consider that text. See issue #2197
- Loading branch information
efb5b1a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to confirm, we're using the detection provided by QTextCodec on the full cell contents and not the first few bytes for quick testing? That's what the code is doing, so just making sure that was our intention...
efb5b1a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I supposed it would only read the BOM and some bytes. Looking now at the source code, it seems that it reads only the BOM (or I didn't get something right). So the improvement here seems to be, that it is not only enough to start by a BOM, it has to match the encoding that the user has selected. But I'm not expert in Unicode, and don't know how to test all the possible encodings. In Linux, everything seems to use UTF-8 and BOMs are rare.