freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "James K. Lowden" <jklowden AT schemamania.org>
- To: TDS Development Group <freetds AT lists.ibiblio.org>
- Subject: [freetds] iconv structure and function names
- Date: Sun, 30 Mar 2003 14:06:11 -0500
Now that we're going to use iconv for more than ascii-ucs2 conversion, we
need better names and more flexible functions. tdsiconvinfo can be
simplified as follows:
typedef struct tdsiconvinfo
{
int use_iconv;
#if HAVE_ICONV
int bytes_per_char;
char client_charset[64];
iconv_t cdto_ucs2; /* conversion from client charset to UCS2LE
MSSQLServer */
iconv_t cdfrom_ucs2; /* conversion from UCS2LE MSSQLServer to client
charset */
iconv_t cdto_srv; /* conversion from client charset to SQL Server
ASCII charset */
iconv_t cdfrom_srv; /* conversion from SQL Server ASCII charset to
client charset */
#endif
} TDSICONVINFO;
becomes:
typedef struct tdsiconvinfo
{
char client_charset[64];
char server_charset[64];
iconv_t to_wire; /* conversion from client charset to server's
format
*/
iconv_t from_wire; /* conversion from server's format to client
charset
*/
} TDSICONVINFO;
If either iconv_t is NULL, that's the equivalent of use_iconv == 0.
Then, instead of
char* tds7_ascii2unicode(TDSSOCKET * tds, const char *in_string,
char *out_string, int maxlen);
and its complement, I propose:
size_t tds_iconv (iconv_t cd, const char *input, size_t * input_size,
char *out_string, size_t maxlen);
[I don't understand why iconv uses char* instead of unsigned char*.]
If "cd" is NULL, fallback to #if !HAVE_ICONV behavior. Whether you're
converting from or to wire format is controlled by passing the to_wire or
from_wire descriptor.
I've eliminated bytes_per_char, too, since utf-8 has no fixed value for
it. If we need to estimate how big a buffer to use in conversion, 4
bytes/char is always safe for the foreseeable future.
These changes will remove assumptions about the server's format and TDS
version (allowing migration to UTF-8 as a Sybase server character set).
Please tell me if I've overlooked something, or if you have a better idea,
or if you think I've lost my mind.
Regards,
--jkl
-
[freetds] iconv structure and function names,
James K. Lowden, 03/30/2003
-
Re: [freetds] iconv structure and function names,
Frediano Ziglio, 03/30/2003
-
Re: [freetds] iconv structure and function names,
James K. Lowden, 03/30/2003
-
Re: [freetds] iconv structure and function names,
Frediano Ziglio, 03/30/2003
- Re: [freetds] iconv structure and function names, James K. Lowden, 03/30/2003
-
Re: [freetds] iconv structure and function names,
Frediano Ziglio, 03/30/2003
-
Re: [freetds] iconv structure and function names,
James K. Lowden, 03/30/2003
-
Re: [freetds] iconv structure and function names,
Frediano Ziglio, 03/30/2003
Archive powered by MHonArc 2.6.24.