]> git.ozlabs.org Git - petitboot/commitdiff
ui/ncurses: Ensure boot option labels are displayable as menu items
authorJeremy Kerr <jk@ozlabs.org>
Thu, 13 Mar 2014 07:18:04 +0000 (15:18 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Thu, 10 Apr 2014 03:18:26 +0000 (11:18 +0800)
ncurses' new_item() expects the name parameter to be a "printable
string", by converting it to a wchar *, and checking that each character
is printable with iswprint(). If it fails, we won't see a boot option at
all.

This change introduces a function to convert the label into something we
know is printable, and valid UTF-8. If mbstowcs fails, we replace it
with a generic 'Invalid option' label. If we encounter a valid multibyte
string with unprintable characters, we replace those with U+fffd
REPLACEMENT CHARACTER.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

No differences found