FreeTDS API
Loading...
Searching...
No Matches
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 <freetds/bool.h>
#include <freetds/utils/bjoern-utf8.h>
#include "iconv_charsets.h"
Include dependency graph for iconv.c:

Macros

#define CD   ((int) (TDS_INTPTR) cd)
 
#define CP1252(i, o)   case o: c = i; break;
 
#define MASK(n)   ((0xffffffffu << (n)) & 0xffffffffu)
 

Typedefs

typedef uint32_t 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_cp1252 (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_cp1252 (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.
 

Variables

static const iconv_get_t iconv_gets [16]
 
static const iconv_put_t iconv_puts [16]
 

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, CP1252, UTF-16, UCS-4 and UTF-8