btrfs-progs icon indicating copy to clipboard operation
btrfs-progs copied to clipboard

inspect dump-tree: encode non-printable filenames and xattrs

Open kdave opened this issue 4 years ago • 1 comments

As reported eg. in #350, xattrs can contain characters that are either not printable or cause formatting changes when printed (like newlines). The same holds for filenames.

  1. Non-printable characters (and maybe some printable ones as exceptions) could be encoded, eg. like in C with \x00 so that they can be easily converted by common tools.
  2. Alternatively we can use iconv to do conversion from raw bytes to any output encoding so eg. filenames in CJK are readable. ~~To avoid hard dependency on libiconv, this can be done by dlopen (iconv_open, iconv, iconv_close) and do nothing as fallback.~~ iconv is part of glibc.
  3. The conversion should be done when requested by an option as we don't have a good default

kdave avatar Sep 20 '21 13:09 kdave

Iconv is also available in musl so there's no problem with compatibility.

kdave avatar Apr 19 '23 15:04 kdave