FreeTDS API

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 <freetds/bool.h>`
`#include <freetds/bytes.h>`
`#include <freetds/encodings.h>`
`#include <freetds/charset_lookup.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 (TDSCONNECTION *conn, TDS_UCHAR collate[5])
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, TDS_UCHAR collation[5])
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)
TDSICONV * | tds_iconv_from_collate (TDSCONNECTION *conn, TDS_UCHAR collate[5])
| Get iconv information from a LCID (to support different column encoding under MSSQL2K)
TDSICONV * | tds_iconv_get (TDSCONNECTION *conn, const char *client_charset, const char *server_charset)
TDSICONV * | tds_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 [TDS_VECTOR_SIZE(canonic_charsets)]
struct {
char data [15]
uint8_t len
} | test_strings [4]
static const char * | ucs2name

## Detailed Description

Handle character conversions to/from server.

## Macro Definition Documentation

## ◆ CHARSIZE

#define CHARSIZE | ( |  | charset | ) |

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

## Function Documentation

## ◆ tds_iconv_alloc()

int tds_iconv_alloc | ( | TDSCONNECTION * | conn | ) |

Allocate iconv stuff.

Returns
  0 for success

## Variable Documentation

## ◆ test_strings

const { ... } test_strings[4]

Initial value:
= {
{ 4, "Ao\xD3\xE5" },
{ 6, "Ao\xC3\x93\xC3\xA5" },
{ 8, "A\x00o\x000\xD3\x00\xE5\x00" },
{ 8, "\x00" "A\x00o\x000\xD3\x00\xE5" },
}