[freetds] detecting iconv names

Frediano Ziglio freddyz77 at tin.it
Fri May 2 14:45:32 EDT 2003


Il ven, 2003-05-02 alle 20:19, Lowden, James K ha scritto:
> > 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.  
> 

I'm thinking about it.
My first intention was to check inside configure. However anyone can
decide to use another iconv library instead (using
--with-libiconv-prefix parameter). Using iconv command we use probably
system iconv, not linked one...
Perhaps some code inside AC_TRY_RUN ?? Or a program compiled (how to
compile from configure in a portable way?) and launched by configure if
non-GNU iconv is detected ??
My Linux iconv (GNU) detect ISO8859-1 while Max OS X iconv (GNU) not...

freddy77




More information about the FreeTDS mailing list