summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2021-02-27 14:08:36 +0100
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2021-03-07 17:37:13 +0100
commit73bb90cabcdffcd528d1002a12779779196bf200 (patch)
tree5c4fb2a3ebecf079f4cadacc41aa9e45354e69a0 /include
parent70616a1ed8c7fe22aa19eb674915623bd236926f (diff)
downloadu-boot-73bb90cabcdffcd528d1002a12779779196bf200.tar.gz
u-boot-73bb90cabcdffcd528d1002a12779779196bf200.tar.xz
u-boot-73bb90cabcdffcd528d1002a12779779196bf200.zip
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>
Diffstat (limited to 'include')
-rw-r--r--include/charset.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/charset.h b/include/charset.h
index 64ba91f791..52e7d1474e 100644
--- a/include/charset.h
+++ b/include/charset.h
@@ -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_ */