diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2021-02-27 14:08:38 +0100 |
---|---|---|
committer | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2021-03-07 17:37:13 +0100 |
commit | e91789e2f6611c0d7f3510691c154e524e7cfa43 (patch) | |
tree | 98e84ebbc76d03a249e8db3794b54ef834ba7a26 /include | |
parent | ddbaff53da5b99563fa371db0b09544e139fdabb (diff) | |
download | u-boot-e91789e2f6611c0d7f3510691c154e524e7cfa43.tar.gz u-boot-e91789e2f6611c0d7f3510691c154e524e7cfa43.tar.bz2 u-boot-e91789e2f6611c0d7f3510691c154e524e7cfa43.zip |
lib/charset: UTF-8 stream conversion
Provide functions to convert an UTF-8 stream to code page 437 or UTF-32.
Add unit tests.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/charset.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/charset.h b/include/charset.h index 52e7d1474e..a911160f19 100644 --- a/include/charset.h +++ b/include/charset.h @@ -286,4 +286,22 @@ uint8_t *utf16_to_utf8(uint8_t *dest, const uint16_t *src, size_t size); */ int utf_to_cp(s32 *c, const u16 *codepage); +/** + * utf8_to_cp437_stream() - convert UTF-8 stream to codepage 437 + * + * @c: next UTF-8 character to convert + * @buffer: buffer, at least 5 characters + * Return: next codepage 437 character or 0 + */ +int utf8_to_cp437_stream(u8 c, char *buffer); + +/** + * utf8_to_utf32_stream() - convert UTF-8 stream to UTF-32 + * + * @c: next UTF-8 character to convert + * @buffer: buffer, at least 5 characters + * Return: next codepage 437 character or 0 + */ +int utf8_to_utf32_stream(u8 c, char *buffer); + #endif /* __CHARSET_H_ */ |