XBinder  Version 2.9.x
Functions
rtxUTF16.h File Reference

Utility functions for converting UTF-16(LE|BE) strings to and from UTF-8. More...

#include "rtxsrc/rtxContext.h"

Go to the source code of this file.

Functions

EXTERNRT int rtxUTF16LEToUTF8 (unsigned char *out, int outlen, const unsigned char *inb, int inlenb)
 This function converts a UTF-16LE string into a UTF-8 string. More...
 
EXTERNRT int rtxUTF8ToUTF16LE (unsigned char *outb, int outlen, const unsigned char *in, int inlen)
 This function converts a UTF-8 string into a UTF-16LE string. More...
 
EXTERNRT int rtxUTF8ToUTF16 (unsigned char *outb, int outlen, const unsigned char *in, int inlen)
 This function converts a UTF-8 string into a UTF-16 string. More...
 
EXTERNRT int rtxUTF16BEToUTF8 (unsigned char *out, int outlen, const unsigned char *inb, int inlenb)
 This function converts a UTF-16BE string into a UTF-8 string. More...
 
EXTERNRT int rtxUTF8ToUTF16BE (unsigned char *outb, int outlen, const unsigned char *in, int inlen)
 This function converts a UTF-8 string into a UTF-16BE string. More...
 
EXTERNRT int rtxStreamUTF8ToUTF16 (OSCTXT *pctxt, const unsigned char *in, size_t inlen)
 This function takes a block of UTF-8 chars in and try to convert it to an UTF-16 block of chars, and write the converted chars to stream. More...
 
EXTERNRT int rtxStreamUTF8ToUTF16LE (OSCTXT *pctxt, const unsigned char *in, size_t inlen)
 This function takes a block of UTF-8 chars in and try to convert it to an UTF-16LE block of chars, and write the converted chars to stream. More...
 
EXTERNRT int rtxStreamUTF8ToUTF16BE (OSCTXT *pctxt, const unsigned char *in, size_t inlen)
 This function takes a block of UTF-8 chars in and try to convert it to an UTF-16BE block of chars, and write the converted chars to stream. More...
 

Detailed Description

Utility functions for converting UTF-16(LE|BE) strings to and from UTF-8.

Definition in file rtxUTF16.h.

Function Documentation

◆ rtxStreamUTF8ToUTF16()

EXTERNRT int rtxStreamUTF8ToUTF16 ( OSCTXT pctxt,
const unsigned char *  in,
size_t  inlen 
)

This function takes a block of UTF-8 chars in and try to convert it to an UTF-16 block of chars, and write the converted chars to stream.

Parameters
pctxtPointer to context block structure.
inA pointer to an array of UTF-8 chars.
inlenThe length of .
Returns
Total number of bytes in converted string or a negative status code if error: -1 if lack of space, or -2 if the transcoding fails

◆ rtxStreamUTF8ToUTF16BE()

EXTERNRT int rtxStreamUTF8ToUTF16BE ( OSCTXT pctxt,
const unsigned char *  in,
size_t  inlen 
)

This function takes a block of UTF-8 chars in and try to convert it to an UTF-16BE block of chars, and write the converted chars to stream.

Parameters
pctxtPointer to context block structure.
inA pointer to an array of UTF-8 chars.
inlenThe length of .
Returns
Total number of bytes in converted string or a negative status code if error: -1 if lack of space, or -2 if the transcoding fails

◆ rtxStreamUTF8ToUTF16LE()

EXTERNRT int rtxStreamUTF8ToUTF16LE ( OSCTXT pctxt,
const unsigned char *  in,
size_t  inlen 
)

This function takes a block of UTF-8 chars in and try to convert it to an UTF-16LE block of chars, and write the converted chars to stream.

Parameters
pctxtPointer to context block structure.
inA pointer to an array of UTF-8 chars.
inlenThe length of .
Returns
Total number of bytes in converted string or a negative status code if error: -1 if lack of space, or -2 if the transcoding fails

◆ rtxUTF16BEToUTF8()

EXTERNRT int rtxUTF16BEToUTF8 ( unsigned char *  out,
int  outlen,
const unsigned char *  inb,
int  inlenb 
)

This function converts a UTF-16BE string into a UTF-8 string.

A buffer large enough to hold the converted UTF-8 characters must be provided. A buffer providing 4 bytes-per-character should be large enough to hold the largest possible UTF-8 conversion. This function assumes the endian property is the same between the native type of this machine and the inputed one.

Parameters
outBuffer to hold converted string.
outlenSize of output buffer.
inbA pointer to an array of UTF-16LE passed as a byte array.
inlenbThe length of in UTF-16LE characters.
Returns
Total number of bytes in converted string or a negative status code if error: -1 if lack of space, or -2 if the transcoding fails (if *inb is not a valid utf16 string)

◆ rtxUTF16LEToUTF8()

EXTERNRT int rtxUTF16LEToUTF8 ( unsigned char *  out,
int  outlen,
const unsigned char *  inb,
int  inlenb 
)

This function converts a UTF-16LE string into a UTF-8 string.

A buffer large enough to hold the converted UTF-8 characters must be provided. A buffer providing 4 bytes-per-character should be large enough to hold the largest possible UTF-8 conversion. This function assumes the endian property is the same between the native type of this machine and the inputed one.

Parameters
outBuffer to hold converted string.
outlenSize of output buffer.
inbA pointer to an array of UTF-16LE passed as a byte array.
inlenbThe length of in UTF-16LE characters.
Returns
Total number of bytes in converted string or a negative status code if error: -1 if lack of space, or -2 if the transcoding fails (if *inb is not a valid utf16 string)

◆ rtxUTF8ToUTF16()

EXTERNRT int rtxUTF8ToUTF16 ( unsigned char *  outb,
int  outlen,
const unsigned char *  in,
int  inlen 
)

This function converts a UTF-8 string into a UTF-16 string.

A buffer large enough to hold the converted UTF-16 characters must be provided.

Parameters
outbBuffer to hold converted string.
outlenSize of output buffer.
inA pointer to an array of UTF-8 chars
inlenThe length of
Returns
Total number of bytes in converted string or a negative status code if error: -1 if lack of space, or -2 if the transcoding fails

◆ rtxUTF8ToUTF16BE()

EXTERNRT int rtxUTF8ToUTF16BE ( unsigned char *  outb,
int  outlen,
const unsigned char *  in,
int  inlen 
)

This function converts a UTF-8 string into a UTF-16BE string.

A buffer large enough to hold the converted UTF-16 characters must be provided.

Parameters
outbBuffer to hold converted string.
outlenSize of output buffer.
inA pointer to an array of UTF-8 chars
inlenThe length of
Returns
Total number of bytes in converted string or a negative status code if error: -1 if lack of space, or -2 if the transcoding fails

◆ rtxUTF8ToUTF16LE()

EXTERNRT int rtxUTF8ToUTF16LE ( unsigned char *  outb,
int  outlen,
const unsigned char *  in,
int  inlen 
)

This function converts a UTF-8 string into a UTF-16LE string.

A buffer large enough to hold the converted UTF-16 characters must be provided.

Parameters
outbBuffer to hold converted string.
outlenSize of output buffer.
inA pointer to an array of UTF-8 chars
inlenThe length of
Returns
Total number of bytes in converted string or a negative status code if error: -1 if lack of space, or -2 if the transcoding fails