mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-28 23:09:32 -06:00
Detect data with embedded zeros as binary also for ISO-8859
See issues #1772 and #1773
This commit is contained in:
@@ -17,10 +17,11 @@ bool isTextOnly(QByteArray data, const QString& encoding, bool quickTest)
|
||||
if(startsWithBom(data))
|
||||
return true;
|
||||
|
||||
// We can assume that the default encoding (UTF-8) cannot contain character zero.
|
||||
// This has to be checked explicitly because toUnicode() is ignoring bytes beyond
|
||||
// the zero.
|
||||
if(encoding.isEmpty() && data.contains('\0'))
|
||||
// We can assume that the default encoding (UTF-8) and all the ISO-8859
|
||||
// cannot contain character zero.
|
||||
// This has to be checked explicitly because toUnicode() is using zero as
|
||||
// a terminator for these encodings.
|
||||
if((encoding.isEmpty() || encoding.startsWith("ISO-8859")) && data.contains('\0'))
|
||||
return false;
|
||||
|
||||
// Truncate to the first couple of bytes for quick testing
|
||||
|
||||
Reference in New Issue
Block a user