Skip to content

QByteArray pretty printer: deal with non-utf8 data correctly

David Faure requested to merge work/dfaure/QByteArray into master

Instead of raising a UTF-8 decoding exception, use latin1 decoding to show the data "as is".

The unittest ensures we don't stop at NUL bytes, too.

(gdb) p nonUtf
$1 = "ABCÿ\000þ" = {
  [0] = 65 'A',
  [1] = 66 'B',
  [2] = 67 'C',
  [3] = -1 '\377',
  [4] = 0 '\000',
  [5] = -2 '\376'
}
Edited by David Faure

Merge request reports

Loading