Defines | Typedefs | Functions

ut_iconv.h File Reference

#include "ut_types.h"

Go to the source code of this file.


#define UT_ICONV_INVALID   ((UT_iconv_t)(-1))
#define UCS_2_INTERNAL   ucs2Internal()
#define UCS_INTERNAL   ucs4Internal()


typedef void * UT_iconv_t


char * 
ucs2Internal ()
ABI_EXPORT const char * ucs4Internal ()
ABI_EXPORT UT_iconv_t UT_iconv_open (const char *to, const char *from)
ABI_EXPORT size_t UT_iconv (UT_iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
ABI_EXPORT int UT_iconv_close (UT_iconv_t cd)
ABI_EXPORT void UT_iconv_reset (UT_iconv_t cd)
ABI_EXPORT int UT_iconv_isValid (UT_iconv_t cd)
ABI_EXPORT char * UT_convert (const char *str, UT_sint32 len, const char *from_codeset, const char *to_codeset, UT_uint32 *bytes_read, UT_uint32 *bytes_written)
ABI_EXPORT char * UT_convert_cd (const char *str, UT_sint32 len, UT_iconv_t cd, UT_uint32 *bytes_read, UT_uint32 *bytes_written)

Define Documentation

#define UCS_2_INTERNAL   ucs2Internal()
#define UCS_INTERNAL   ucs4Internal()
#define UT_ICONV_INVALID   ((UT_iconv_t)(-1))

Typedef Documentation

typedef void* UT_iconv_t

Function Documentation

G_BEGIN_DECLS ABI_EXPORT const char* ucs2Internal (  ) 
the internal iconv UCS-2 charset name

References s_internal_init().

ABI_EXPORT const char* ucs4Internal (  ) 
the internal iconv UCS-4 charset name

References s_internal_init().

Referenced by init_values(), and UT_Wctomb::setOutCharset().

ABI_EXPORT char* UT_convert ( const char *  str,
UT_sint32  len,
const char *  from_codeset,
const char *  to_codeset,
UT_uint32 bytes_read_arg,
UT_uint32 bytes_written_arg 

Borrowed from GLib 2.0 and (heavily) modified

str Pointer to the input string.
len Length of the input string to convert.
from_codeset The "codeset" of the string pointed to by 'str'.
to_codeset The "codeset" we want for the output.
bytes_read optional, supply NULL if you don't want this.
bytes_written optional, supply NULL if you don't want this.
Returns a freshly allocated output string, which is terminated by a zero byte. Note that if the output codeset's terminator is not a zero byte (e.g., UCS-2, where it is two zero bytes), you can get correct termination by including the input string's terminator in the length passed as 'len'. E.g., if 'str' is null-terminated US-ASCII "foo", given 'len' as 4.
Check for out-of-memory allocations etc.

Referenced by IE_Imp_Hancom::_loadFile(), UT_Win32LocaleString::fromUCS4(), UT_Win32LocaleString::fromUTF8(), AP_UnixApp::pasteFromClipboard(), prepare_style_name(), UT_Win32LocaleString::ucs4_str(), UT_std_stringFromEncoding(), UT_UTF8String::UT_UTF8String(), UT_Win32LocaleString::utf8_str(), and utf8_to_ucs2().

ABI_EXPORT char* UT_convert_cd ( const char *  str,
UT_sint32  len,
UT_iconv_t  cd,
UT_uint32 bytes_read_arg,
UT_uint32 bytes_written_arg 

This function is almost the same as the other UT_convert function, only that it takes an UT_iconv_t instead of a from and to codeset. This is useful if you need to do a conversion multiple times

Referenced by IE_Imp_StarOffice::_loadFile(), XAP_StringSet::getValue(), DocHdr::load(), and readByteString().

ABI_EXPORT size_t UT_iconv ( UT_iconv_t  cd,
const char **  inbuf,
size_t *  inbytesleft,
char **  outbuf,
size_t *  outbytesleft 
ABI_EXPORT int UT_iconv_close ( UT_iconv_t  cd  ) 
ABI_EXPORT int UT_iconv_isValid ( UT_iconv_t  cd  ) 
ABI_EXPORT UT_iconv_t UT_iconv_open ( const char *  to,
const char *  from 
ABI_EXPORT void UT_iconv_reset ( UT_iconv_t  cd  )