[freetds] detecting iconv names

Lowden, James K LowdenJK at bernstein.com
Fri May 2 14:19:39 EDT 2003


> From: ZIGLIO Frediano [mailto:Frediano.Ziglio at vodafoneomnitel.it]
> Sent: May 2, 2003 11:00 AM
> 
> So, a script like 
>   OUT=`echo foo | iconv -f iso88591 -t ucs2 | cksum | cut -d ' ' -f 1`
> is portable !!!
> I must check results cause some iconv put bytes in front of 
> ucs2 if no endian specified...
> 
> Whatching configure this code should also be portable
> 
> tds_iconvtest='echo $TDSSTR | iconv -f $TDSFROM -t $TDSTO | 
> cksum | cut -d " " -f 1'
> TDSSTR=foo
> TDSFROM=iso88591
> TDSTO=ucs2
> if test "`eval $tds_iconvtest`" = "3637111430"; then
> 	echo Successfully converted !
> fi

Yes, except "iso88591" isn't portable,  of course, unless you run it though
tds_canonical_charset_name(), subject to its limitations.  

I really think tds_canonical_charset_name() is the key, btw.  It must work,
for us to convert server charset names to iconv names i.e., return a name
that the linked-in iconv will honor.  Making it for "any" iconv is no simple
thing, of course, but that doesn't make it any less necessary.  To the
extent that we care about non-GNU iconv, that is.  

Noodle: it might be nice to have a little utility, src/apps/charsetname,
that prints the canonical name (and iconv vendor) for any input.  Would help
your scripts and be a simple diagnostic.  Could be a feature of tsql
instead, like my "version" command and -C switch, but then tsql would need
an offline mode.  

--jkl


The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named above.  If you are not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, any
review, dissemination, distribution or duplication of this communication is
strictly prohibited. If you are not the intended recipient, please contact
the sender immediately by reply e-mail and destroy all copies of the
original message. Please note that we do not accept account orders and/or
instructions by e-mail, and therefore will not be responsible for carrying
out such orders and/or instructions.




More information about the FreeTDS mailing list