FreeTDS API
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Macros | Enumerations | Functions | Variables
iconv.c File Reference

Handle character conversions to/from server. More...

#include <config.h>
#include <stdarg.h>
#include <stdio.h>
#include <assert.h>
#include <freetds/tds.h>
#include <freetds/iconv.h>
#include "encodings.h"
Include dependency graph for iconv.c:

Macros

#define CHARSIZE(charset)
 
#define CHUNK_ALLOC   4
 
#define TDS_ICONV_ENCODING_TABLES
 

Enumerations

enum  { POS_ISO1, POS_UTF8, POS_UCS2LE, POS_UCS2BE }
 

Functions

static void _iconv_close (iconv_t *cd)
 
static int collate2charset (int sql_collate, int lcid)
 
static int lookup_canonic (const CHARACTER_SET_ALIAS aliases[], const char *charset_name)
 
static size_t skip_one_input_sequence (iconv_t cd, const TDS_ENCODING *charset, const char **input, size_t *input_size)
 Move the input sequence pointer to the next valid position. More...
 
void tds7_srv_charset_changed (TDSCONNECTION *conn, int sql_collate, int lcid)
 
static int tds_canonical_charset (const char *charset_name)
 Determine canonical iconv character set. More...
 
const char * tds_canonical_charset_name (const char *charset_name)
 Determine canonical iconv character set name. More...
 
size_t tds_iconv (TDSSOCKET *tds, TDSICONV *conv, TDS_ICONV_DIRECTION io, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
 Wrapper around iconv(3). More...
 
int tds_iconv_alloc (TDSCONNECTION *conn)
 Allocate iconv stuff. More...
 
void tds_iconv_close (TDSCONNECTION *conn)
 
static void tds_iconv_err (TDSSOCKET *tds, int err)
 
void tds_iconv_free (TDSCONNECTION *conn)
 
TDSICONVtds_iconv_from_collate (TDSCONNECTION *conn, TDS_UCHAR collate[5])
 Get iconv information from a LCID (to support different column encoding under MSSQL2K)
 
TDSICONVtds_iconv_get (TDSCONNECTION *conn, const char *client_charset, const char *server_charset)
 
static TDSICONVtds_iconv_get_info (TDSCONNECTION *conn, int canonic_client, int canonic_server)
 Get a iconv info structure, allocate and initialize if needed.
 
static void tds_iconv_info_close (TDSICONV *char_conv)
 
static int tds_iconv_info_init (TDSICONV *char_conv, int client_canonical, int server_canonical)
 Open iconv descriptors to convert between character sets (both directions). More...
 
static int tds_iconv_init (void)
 Initialize charset searching for UTF-8, UCS-2 and ISO8859-1.
 
TDSRET tds_iconv_open (TDSCONNECTION *conn, const char *charset, int use_utf16)
 
static void tds_iconv_reset (TDSICONV *conv)
 
static const char * tds_set_iconv_name (int charset)
 Get iconv name given canonic.
 
void tds_srv_charset_changed (TDSCONNECTION *conn, const char *charset)
 
static void tds_srv_charset_changed_num (TDSCONNECTION *conn, int canonic_charset_num)
 

Variables

static int iconv_initialized = 0
 
static const char * iconv_names [sizeof(canonic_charsets)/sizeof(canonic_charsets[0])]
 
static const char * ucs2name
 

Detailed Description

Handle character conversions to/from server.

Macro Definition Documentation

#define CHARSIZE (   charset)
Value:
( ((charset)->min_bytes_per_char == (charset)->max_bytes_per_char )? \
(charset)->min_bytes_per_char : 0 )

Function Documentation

int tds_iconv_alloc ( TDSCONNECTION conn)

Allocate iconv stuff.

Returns
0 for success