FreeTDS API

Macros | Typedefs | Enumerations | Functions | Variables
iconv.c File Reference

This file implements a very simple iconv. More...

`#include <config.h>`
`#include <assert.h>`
`#include <ctype.h>`
`#include <freetds/tds.h>`
`#include <freetds/bytes.h>`
`#include <freetds/iconv.h>`
Include dependency graph for iconv.c:

## Macros

#define | CD ((int) (TDS_INTPTR) cd)
#define | MASK(n) ((0xffffffffu << (n)) & 0xffffffffu)

## Typedefs

typedef TDS_UINT | ICONV_CHAR
typedef int(* | iconv_get_t) (const unsigned char *p, size_t len, ICONV_CHAR *out)
typedef int(* | iconv_put_t) (unsigned char *buf, size_t buf_len, ICONV_CHAR c)

## Enumerations

enum | ICONV_CD_VALUE { Like_to_Like = 0x100 }

## Functions

static int | get_ascii (const unsigned char *p, size_t len, ICONV_CHAR *out)
static int | get_err (const unsigned char *p, size_t len, ICONV_CHAR *out)
static int | get_iso1 (const unsigned char *p, size_t len, ICONV_CHAR *out)
static int | get_ucs4be (const unsigned char *p, size_t len, ICONV_CHAR *out)
static int | get_ucs4le (const unsigned char *p, size_t len, ICONV_CHAR *out)
static int | get_utf16be (const unsigned char *p, size_t len, ICONV_CHAR *out)
static int | get_utf16le (const unsigned char *p, size_t len, ICONV_CHAR *out)
static int | get_utf8 (const unsigned char *p, size_t len, ICONV_CHAR *out)
static int | put_ascii (unsigned char *buf, size_t buf_len, ICONV_CHAR c)
static int | put_err (unsigned char *buf, size_t buf_len, ICONV_CHAR c)
static int | put_iso1 (unsigned char *buf, size_t buf_len, ICONV_CHAR c)
static int | put_ucs4be (unsigned char *buf, size_t buf_len, ICONV_CHAR c)
static int | put_ucs4le (unsigned char *buf, size_t buf_len, ICONV_CHAR c)
static int | put_utf16be (unsigned char *buf, size_t buf_len, ICONV_CHAR c)
static int | put_utf16le (unsigned char *buf, size_t buf_len, ICONV_CHAR c)
static int | put_utf8 (unsigned char *buf, size_t buf_len, ICONV_CHAR c)
size_t | tds_sys_iconv (iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
int | tds_sys_iconv_close (iconv_t cd)
iconv_t | tds_sys_iconv_open (const char *tocode, const char *fromcode)
| Inputs are FreeTDS canonical names, no other. More...

## Variables

static const iconv_get_t | iconv_gets [8]
static const iconv_put_t | iconv_puts [8]
static const unsigned char | utf8_lengths [256]
static const unsigned char | utf8_masks [7]

## Detailed Description

This file implements a very simple iconv.

Its purpose is to allow ASCII clients to communicate with Microsoft servers that encode their metadata in Unicode (UTF-16).

It supports ISO-8859-1, ASCII, UTF-16, UCS-4 and UTF-8