libcdio  2.1.0
About: GNU libcdio is a library for CD-ROM and CD image access.
  Fossies Dox: libcdio-2.1.0.tar.bz2  ("inofficial" and yet experimental doxygen-generated source code documentation)  

utf8.h File Reference

UTF-8 support. More...

#include <cdio/types.h>
Include dependency graph for utf8.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct cdio_charset_coverter_s cdio_charset_coverter_t
 Opaque characterset converter. More...
 

Functions

cdio_charset_coverter_tcdio_charset_converter_create (const char *src_charset, const char *dst_charset)
 Create a charset converter. More...
 
void cdio_charset_converter_destroy (cdio_charset_coverter_t *cnv)
 Destroy a characterset converter. More...
 
bool cdio_charset_convert (cdio_charset_coverter_t *cnv, char *src, int src_len, char **dst, int *dst_len)
 Convert a string from one character set to another. More...
 
bool cdio_charset_from_utf8 (cdio_utf8_t *src, char **dst, int *dst_len, const char *dst_charset)
 Convert a string from UTF-8 to another charset. More...
 
bool cdio_charset_to_utf8 (const char *src, size_t src_len, cdio_utf8_t **dst, const char *src_charset)
 Convert a string from another charset to UTF-8. More...
 

Detailed Description

UTF-8 support.

Definition in file utf8.h.

Typedef Documentation

◆ cdio_charset_coverter_t

typedef struct cdio_charset_coverter_s cdio_charset_coverter_t

Opaque characterset converter.

Definition at line 29 of file utf8.h.

Function Documentation

◆ cdio_charset_convert()

bool cdio_charset_convert ( cdio_charset_coverter_t cnv,
char *  src,
int  src_len,
char **  dst,
int *  dst_len 
)

Convert a string from one character set to another.

Parameters
cnvA charset converter
srcSource string
src_lenLength of source string
dstReturns destination string
dst_lenIf non NULL, returns the length of the destination string
Returns
true if conversion was sucessful, false else.

The destination string must be freed by the caller with cdio_free(). If you pass -1 for src_len, strlen() will be used.

◆ cdio_charset_converter_create()

cdio_charset_coverter_t* cdio_charset_converter_create ( const char *  src_charset,
const char *  dst_charset 
)

Create a charset converter.

Parameters
src_charsetSource charset
dst_charsetDestination charset
Returns
A newly allocated charset converter

◆ cdio_charset_converter_destroy()

void cdio_charset_converter_destroy ( cdio_charset_coverter_t cnv)

Destroy a characterset converter.

Parameters
cnvA characterset converter

◆ cdio_charset_from_utf8()

bool cdio_charset_from_utf8 ( cdio_utf8_t src,
char **  dst,
int *  dst_len,
const char *  dst_charset 
)

Convert a string from UTF-8 to another charset.

Parameters
srcSource string (0 terminated)
dstReturns destination string
dst_lenIf non NULL, returns the length of the destination string
dst_charsetThe characterset to convert to
Returns
true if conversion was sucessful, false else.

This is a convenience function, which creates a charset converter, converts one string and destroys the charset converter.

The destination string must be freed by the caller with cdio_free().

◆ cdio_charset_to_utf8()

bool cdio_charset_to_utf8 ( const char *  src,
size_t  src_len,
cdio_utf8_t **  dst,
const char *  src_charset 
)

Convert a string from another charset to UTF-8.

Parameters
srcSource string
src_lenLength of the source string
dstReturns destination string (0 terminated)
src_charsetThe characterset to convert from
Returns
true if conversion was sucessful, false else.

This is a convenience function, which creates a charset converter, converts one string and destroys the charset converter.

The destination string must be freed by the caller with cdio_free(). If you pass -1 for src_len, strlen() will be used.

Referenced by _iso9660_dir_to_statbuf(), cdtext_set(), get_member_id(), and unicode16_decode().