rtxLatin1.h File Reference

Utility functions for converting ISO 8859-1 strings to and from UTF-8. More...

#include "rtxsrc/rtxContext.h"

Go to the source code of this file.

Functions

EXTERNRT int rtxLatin1ToUTF8 (const OSUTF8CHAR *inbuf, int inlen, OSUTF8CHAR *outbuf, int outbufsize)
 This function converts an ISO 8859-1 encoded string into a UTF-8 string.
EXTERNRT int rtxUTF8ToLatin1 (const OSUTF8CHAR *inbuf, int inlen, OSUTF8CHAR *outbuf, int outbufsize)
 This function converts a UTF-8 encoded byte stream into an ISO 8859-1 encoded string.
EXTERNRT int rtxStreamUTF8ToLatin1 (OSCTXT *pctxt, const OSUTF8CHAR *inbuf, size_t inlen)
 This function converts a UTF-8 encoded byte stream into an ISO 8859-1 encoded string, and write it to stream.

Detailed Description

Utility functions for converting ISO 8859-1 strings to and from UTF-8.

Definition in file rtxLatin1.h.


Function Documentation

EXTERNRT int rtxLatin1ToUTF8 ( const OSUTF8CHAR *  inbuf,
int  inlen,
OSUTF8CHAR *  outbuf,
int  outbufsize 
)

This function converts an ISO 8859-1 encoded 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.

Parameters:
inbuf A pointer to an array of ISO 8859-1 characters.
inlen Number of ISO 8859-1 characters to be converted.
outbuf Buffer to hold converted string.
outbufsize Size of output buffer.
Returns:
Total number of bytes in converted string or a negative status code if error: -1 if lack of space
EXTERNRT int rtxStreamUTF8ToLatin1 ( OSCTXT pctxt,
const OSUTF8CHAR *  inbuf,
size_t  inlen 
)

This function converts a UTF-8 encoded byte stream into an ISO 8859-1 encoded string, and write it to stream.

Parameters:
pctxt Pointer to context block structure.
inbuf A pointer to an array of UTF-8 string.
inlen Number of bytes of the input string.
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 rtxUTF8ToLatin1 ( const OSUTF8CHAR *  inbuf,
int  inlen,
OSUTF8CHAR *  outbuf,
int  outbufsize 
)

This function converts a UTF-8 encoded byte stream into an ISO 8859-1 encoded string.

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

Parameters:
inbuf A pointer to an array of UTF-8 string.
inlen Number of bytes of the input string.
outbuf Buffer to hold converted string.
outbufsize Size of output buffer.
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