1
0
mirror of https://xff.cz/git/u-boot/ synced 2026-01-07 22:09:18 +01:00

efi_loader: carve out utf_to_cp()

Carve out a function to translate a Unicode code point to an 8bit codepage.

Provide a unit test for the new function.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
Heinrich Schuchardt
2021-02-27 14:08:36 +01:00
parent 70616a1ed8
commit 73bb90cabc
4 changed files with 71 additions and 16 deletions

View File

@@ -275,4 +275,15 @@ u16 *u16_strdup(const void *src);
*/
uint8_t *utf16_to_utf8(uint8_t *dest, const uint16_t *src, size_t size);
/**
* utf_to_cp() - translate Unicode code point to 8bit codepage
*
* Codepoints that do not exist in the codepage are rendered as question mark.
*
* @c: pointer to Unicode code point to be translated
* @codepage: Unicode to codepage translation table
* Return: 0 on success, -ENOENT if codepoint cannot be translated
*/
int utf_to_cp(s32 *c, const u16 *codepage);
#endif /* __CHARSET_H_ */