XBinder  Version 2.6.x
Functions
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. More...
 
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. More...
 
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. More...
 

Detailed Description

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

Definition in file rtxLatin1.h.

Function Documentation

◆ rtxLatin1ToUTF8()

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
inbufA pointer to an array of ISO 8859-1 characters.
inlenNumber of ISO 8859-1 characters to be converted.
outbufBuffer to hold converted string.
outbufsizeSize of output buffer.
Returns
Total number of bytes in converted string or a negative status code if error: -1 if lack of space

◆ rtxStreamUTF8ToLatin1()

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
pctxtPointer to context block structure.
inbufA pointer to an array of UTF-8 string.
inlenNumber 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

◆ rtxUTF8ToLatin1()

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
inbufA pointer to an array of UTF-8 string.
inlenNumber of bytes of the input string.
outbufBuffer to hold converted string.
outbufsizeSize 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