[U-Boot] [PATCH 6/8] video/console: Convert UTF-8 codes to CP437 code points

Simon Glass sjg at chromium.org
Sat Mar 30 21:18:49 UTC 2019


Hi Andre,

On Fri, 22 Mar 2019 at 19:32, Andre Przywara <andre.przywara at arm.com> wrote:
>
> The character set used by U-Boot's built-in fonts is the old "code
> page 437" (from the original IBM PC).
> However people would probably expect UTF-8 on a terminal these days, the
> UEFI code definitely does.
>
> Provide a conversion routine to convert a UTF-8 byte stream into a CP437
> character code. This uses a combination of arrays and switch/case
> statements to provide an efficient way of translating the large Unicode
> character range to the 8 bits used for CP437.
>
> This fixes UEFI display on the DM_VIDEO console, which were garbled for
> any non-ASCII characters, for instance for the block graphic characters
> used by Grub to display the menu.
>
> Signed-off-by: Andre Przywara <andre.przywara at arm.com>
> ---
>  drivers/video/Makefile            |   1 +
>  drivers/video/utf8_cp437.c        | 170 ++++++++++++++++++++++++++++++++++++++
>  drivers/video/vidconsole-uclass.c |   8 +-
>  include/video_console.h           |   9 ++
>  4 files changed, 186 insertions(+), 2 deletions(-)
>  create mode 100644 drivers/video/utf8_cp437.c

OMG unicode comes to U-Boot. This might be the beginning of the end.

Can we make this a Kconfig option to avoid increasing code size? We
can imply it when EFI is enabled.

Regards,
Simon


More information about the U-Boot mailing list