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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. |
Detailed Description
Utility functions for converting UTF-16(LE|BE) strings to and from UTF-8.
Definition in file rtxUTF16.h.
Function Documentation
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:
-
pctxt Pointer to context block structure. in A pointer to an array of UTF-8 chars. inlen The 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
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:
-
pctxt Pointer to context block structure. in A pointer to an array of UTF-8 chars. inlen The 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
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:
-
pctxt Pointer to context block structure. in A pointer to an array of UTF-8 chars. inlen The 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
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:
-
out Buffer to hold converted string. outlen Size of output buffer. inb A pointer to an array of UTF-16LE passed as a byte array. inlenb The 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)
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:
-
out Buffer to hold converted string. outlen Size of output buffer. inb A pointer to an array of UTF-16LE passed as a byte array. inlenb The 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)
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:
-
outb Buffer to hold converted string. outlen Size of output buffer. in A pointer to an array of UTF-8 chars inlen The 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
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:
-
outb Buffer to hold converted string. outlen Size of output buffer. in A pointer to an array of UTF-8 chars inlen The 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
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:
-
outb Buffer to hold converted string. outlen Size of output buffer. in A pointer to an array of UTF-8 chars inlen The 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