Developer World
Spresense SDK Library v3.3.0-375c679
unicode converter API

Unicode converter library. More...

Files

file  uconv.h
 

Macros

#define EXTERN   extern "C"
 

Functions

int uconv_utf8_to_ucs2 (int src_size, uint8_t *src, int dst_size, uint16_t *dst)
 
int uconv_ucs2_to_utf8 (int src_size, uint16_t *src, int dst_size, uint8_t *dst)
 

Detailed Description

Unicode converter library.

Function Documentation

◆ uconv_utf8_to_ucs2()

int uconv_utf8_to_ucs2 ( int  src_size,
uint8_t *  src,
int  dst_size,
uint16_t *  dst 
)

Convert a string from UTF-8 format to UCS2.

Parameters
[in]src_sizeByte length of string encoded in UTF-8.
[in]srcString pointer encoded in UTF-8.
[in]dst_sizeMaximum Byte length of UCS2 string buffer.
[out]dstPointer stores the character string converted to UCS2 format.
Returns
On success, it returns the number of bytes in the converted string buffer. Otherwise negative value is returned according to <errno.h>.

◆ uconv_ucs2_to_utf8()

int uconv_ucs2_to_utf8 ( int  src_size,
uint16_t *  src,
int  dst_size,
uint8_t *  dst 
)

Convert a string from UCS2 format to UTF-8.

Parameters
[in]src_sizeByte length of string encoded in UCS2.
[in]srcString pointer encoded in UCS2.
[in]dst_sizeMaximum Byte length of UTF-8 string buffer.
[out]dstPointer stores the character string converted to UTF-8 format.
Returns
On success, it returns the number of bytes in the converted string buffer. Otherwise negative value is returned according to <errno.h>.