* @brief Returns true when a byte sample looks like binary (NUL byte or invalid UTF-8). */
| 279 | * @brief Returns true when a byte sample looks like binary (NUL byte or invalid UTF-8). |
| 280 | */ |
| 281 | static bool looksBinary(const QByteArray& sample) |
| 282 | { |
| 283 | if (sample.contains('\0')) |
| 284 | return true; |
| 285 | |
| 286 | auto decoder = QStringDecoder(QStringDecoder::Utf8); |
| 287 | (void)QString(decoder.decode(sample)); |
| 288 | return decoder.hasError(); |
| 289 | } |
| 290 | |
| 291 | //-------------------------------------------------------------------------------------------------- |
| 292 | // Drop allow-list |
no test coverage detected