TianoCore EDK2 master
|
#include <Uefi.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/BaseUcs2Utf8Lib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
Go to the source code of this file.
Functions | |
UINT8 | GetUTF8SizeForUCS2 (IN CHAR8 *Utf8Buffer) |
EFI_STATUS | GetUCS2CharByFormat (IN CHAR8 *Utf8Buffer, OUT CHAR16 *Ucs2Char) |
UINT8 | UCS2CharToUTF8 (IN CHAR16 Ucs2Char, OUT CHAR8 *Utf8Buffer) |
EFI_STATUS | UTF8ToUCS2Char (IN CHAR8 *Utf8Buffer, OUT CHAR16 *Ucs2Char) |
EFI_STATUS | UCS2StrToUTF8 (IN CHAR16 *Ucs2Str, OUT CHAR8 **Utf8StrAddr) |
EFI_STATUS | UTF8StrToUCS2 (IN CHAR8 *Utf8Str, OUT CHAR16 **Ucs2StrAddr) |
UCS2 to UTF8 manipulation library.
Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
(C) Copyright 2020 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file BaseUcs2Utf8Lib.c.
EFI_STATUS GetUCS2CharByFormat | ( | IN CHAR8 * | Utf8Buffer, |
OUT CHAR16 * | Ucs2Char | ||
) |
Since each UCS2 character can be represented by the format: \uXXXX, this function is used to retrieve the UCS2 character from a Unicode format. Call MUST make sure there are at least 6 Bytes in the input UTF8 buffer.
[in] | Utf8Buffer | The buffer for UTF8 encoded data. |
[out] | Ucs2Char | The converted UCS2 character. |
EFI_INVALID_PARAMETER | Non-Ascii characters found in the hexadecimal digits string, and can't be converted to a UCS2 character. |
EFI_SUCCESS | The UCS2 character has been retrieved. |
two Hexadecimal digits Ascii string, like "3F"
Definition at line 73 of file BaseUcs2Utf8Lib.c.
UINT8 GetUTF8SizeForUCS2 | ( | IN CHAR8 * | Utf8Buffer | ) |
Since each UCS2 character can be represented by 1-3 UTF8 encoded characters, this function is used to retrieve the UTF8 encoding size for a UCS2 character.
[in] | Utf8Buffer | The buffer for UTF8 encoded data. |
Return | the size of UTF8 encoding string or 0 if it is not for UCS2 format. |
Definition at line 28 of file BaseUcs2Utf8Lib.c.
Convert a UCS2 character to UTF8 encoding string.
[in] | Ucs2Char | The provided UCS2 character. |
[out] | Utf8Buffer | The converted UTF8 encoded data. |
Return | the size of UTF8 encoding data for this UCS2 character. |
Ucs2Number >= 0x0800 && Ucs2Number <= 0xFFFF
Definition at line 122 of file BaseUcs2Utf8Lib.c.
EFI_STATUS UCS2StrToUTF8 | ( | IN CHAR16 * | Ucs2Str, |
OUT CHAR8 ** | Utf8StrAddr | ||
) |
Convert a UCS2 string to a UTF8 encoded string.
[in] | Ucs2Str | The provided UCS2 string. |
[out] | Utf8StrAddr | The converted UTF8 string address. Caller is responsible for Free this string. |
EFI_INVALID_PARAMETER | One or more parameters are invalid. |
EFI_OUT_OF_RESOURCES | System runs out of resources. |
EFI_SUCCESS | The UTF8 encoded string has been converted. |
Definition at line 266 of file BaseUcs2Utf8Lib.c.
EFI_STATUS UTF8StrToUCS2 | ( | IN CHAR8 * | Utf8Str, |
OUT CHAR16 ** | Ucs2StrAddr | ||
) |
Convert a UTF8 encoded string to a UCS2 string.
[in] | Utf8Str | The provided UTF8 encoded string. |
[out] | Ucs2StrAddr | The converted UCS2 string address. Caller is responsible for Free this string. |
EFI_INVALID_PARAMETER | The UTF8 encoded string is not valid to convert to UCS2 string. One or more parameters are invalid. |
EFI_OUT_OF_RESOURCES | System runs out of resources. |
EFI_SUCCESS | The UCS2 string has been converted. |
Definition at line 327 of file BaseUcs2Utf8Lib.c.
EFI_STATUS UTF8ToUCS2Char | ( | IN CHAR8 * | Utf8Buffer, |
OUT CHAR16 * | Ucs2Char | ||
) |
Convert a UTF8 encoded data to a UCS2 character.
[in] | Utf8Buffer | The provided UTF8 encoded data. |
[out] | Ucs2Char | The converted UCS2 character. |
EFI_INVALID_PARAMETER | The UTF8 encoded string is not valid or not for UCS2 character. |
EFI_SUCCESS | The converted UCS2 character. |
Definition at line 170 of file BaseUcs2Utf8Lib.c.