function::user_string_utf16 - Linux


Overview

user_string_utf16 converts a wide string (in UTF-16LE encoding) to a multi-byte string (in UTF-8 encoding).

Syntax

user_string_utf16 ( [ IN ] wchar *in_str )

Options/Flags

None

Examples

wchar_t *in_str = L"Hello, World!";
// ...
char *out_str = user_string_utf16(in_str);

Common Issues

Beware that this function will cause a segfault if NULL is passed as the input string.

Integration

user_string_utf16 can be used with other functions to convert between different character encodings. For example, it can be used with user_string_utf8 to convert a UTF-8 string to a UTF-16LE string:

char *utf8_str = "Hello, World!";
// ...
wchar_t *utf16_str = user_string_utf16(user_string_utf8(utf8_str));

Related Commands

  • user_string_utf32
  • user_string_utf8