diff options
author | Janne Grunau | 2024-03-16 22:50:20 +0100 |
---|---|---|
committer | Heinrich Schuchardt | 2024-03-21 06:56:13 +0100 |
commit | ac72d17fd8fadd62df71547ef2446ef54e3c8ee5 (patch) | |
tree | a115746e618ed9af41a026aa18a09cb87676bba3 /lib/charset.c | |
parent | 5ea38f95c474563de7e0a1fe2fb0e652121b25d5 (diff) |
lib/charset: Map Unicode code points to CP437 code points 1-31
Code page 437 uses code points 1-31 for glyphs instead of control
characters. Map the appropriate Unicode code points to this code points.
Fixes rendering of grub2's menu as EFI application using the
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL on a console with bitmap fonts.
Signed-off-by: Janne Grunau <j@jannau.net>
Diffstat (limited to 'lib/charset.c')
-rw-r--r-- | lib/charset.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/charset.c b/lib/charset.c index 2b43175b1d9..df4f0407485 100644 --- a/lib/charset.c +++ b/lib/charset.c @@ -15,7 +15,7 @@ /** * codepage_437 - Unicode to codepage 437 translation table */ -const u16 codepage_437[128] = CP437; +const u16 codepage_437[160] = CP437; static struct capitalization_table capitalization_table[] = #ifdef CONFIG_EFI_UNICODE_CAPITALIZATION @@ -516,9 +516,12 @@ int utf_to_cp(s32 *c, const u16 *codepage) int j; /* Look up codepage translation */ - for (j = 0; j < 0x80; ++j) { + for (j = 0; j < 0xA0; ++j) { if (*c == codepage[j]) { - *c = j + 0x80; + if (j < 0x20) + *c = j; + else + *c = j + 0x60; return 0; } } |