On Fri, 2025-03-28 at 10:29 +0100, Olivier Gayot wrote:
We shouldn't mask the input character; instead we should do a range check before calling isprint(). Something like:
u16 uc = le16_to_cpu(in[i]); u8 c;
if (uc < 0x80 && (uc == 0 || isprint(uc))) c = uc; else c = '!';
Sounds like a good alternative to me.
Would a conversion from utf-16-le to utf-8 be a viable solution?
If we were adding partition name support today I think UTF-8 conversion would be reasonable, but I would guess that there are now consumers that depend on the output being restricted to ASCII.
Also I think we would still want to replace non-printable code points, and we don't have iswprint() in the kernel.
Ben.