libpayload: UTF-16LE to ASCII conversion

This patch adds a simple function to convert a string in UTF-16LE
to ASCII.

TEST=Ran against a string found in a GPT with the intended outcome
BRANCH=none
BUG=none

Signed-off-by: Dan Ehrenberg <dehrenberg@chromium.org>
Change-Id: I50ca5bfdfbef9e084321b2beb1b8d4194ca5af9c
Reviewed-on: https://chromium-review.googlesource.com/231456
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Dan Ehrenberg 2014-11-21 15:50:27 -08:00 committed by chrome-internal-fetch
commit 1104db8328
2 changed files with 26 additions and 0 deletions

View file

@ -67,6 +67,13 @@ char* strtok(char *str, const char *delim);
char* strtok_r(char *str, const char *delim, char **ptr);
/** @} */
/**
* @defgroup string Unicode functions
* @{
*/
char *utf16le_to_ascii(uint16_t *utf16_string, int maxlen);
/** @} */
/**
* @defgroup string OpenBSD based safe string functions
* @{