Re: FreeTDS, Perl, unicode

"James K. Lowden" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
On Mon, 11 Mar 2013 04:31:41 -0700
Brian Johnson <[email protected]> wrote:

> Log file is attached.
> 
> I'll confess, this whole unicode thing is new to me so I'm not
> certain *how* to set the client encoding.  Is there some docs anybody
> can recommend?

I recommend the appendix in the UG for background information.  :-)

> I'll give the other items you tried a shot when I get going in the 
> morning.

Forget sqsh; thought you were using DBD::Sybase.  You're using
DBD::ODBC, which surely should work.  Try the query with bsqlodbc.  It
should be very easy, e.g.

	$ bsqlodbc -S $S  <<< 'select cast(min(name) as
varchar (30)) as name from systypes'

I'm not able to try that myself right now.  My installed version of
FreeTDS fails with an old error, and atm I can't compile the master
branch.  

Your log file says

	iconv.c:349:setting up conversions for client charset "UTF-8"

so Unicode should be presented to the client as UTF-8.  When it gets
the metadata, is says

> token.c:1486:tds7_get_data_info: 
> 	colname = bill_cd_typ_desc (16 bytes)
> 	type = 47 (char)
> 	server's type = 239 (x UCS-2 char)
> 	column_varint_size = 2
> 	column_size = 20 (20 on server)

which seems to indicate that the UCS-2 NCHAR column is being converted
to CHAR.  Then when you read the row (2 rows, in fact)

> token.c:555:processing result tokens.  marker is  d1(ROW)
> token.c:2304:tds_process_row(): reading column 0 
> token.c:2049:tds_get_data: type 47, varint size 2
> token.c:2110:tds_get_data(): wire column size is 20 

I don't see iconv being invoked to convert to UTF-8.  But I'm not sure
I should....

--jkl


> James K. Lowden wrote:
> > On Mon, 11 Mar 2013 02:42:32 -0700
> > Brian Johnson<[email protected]>  wrote:
> >
> >> I don't see any user/pass info in it, so if needed I could attach
> >> the log.  Though I do see "SQLExecute returns SQL_SUCCESS".
> >
> > You can post a log here.  A TDS 7+ dump won't contain user
> > credentials.
> >
> > You're sure the client encoding is set up correctly, and the Perl
> > knows what to expect?
> >
> > Test other than TDSDUMP:  Besides using Perl, you might try with
> > bsqldb, because if it behaves the same way you have either a setup
> > problem or a bug, and with sqsh, because sqsh also uses the ct-lib
> > API.
> >
> > HTH.
> >
> > --jkl
> > _______________________________________________
> > FreeTDS mailing list
> > [email protected]
> > http://lists.ibiblio.org/mailman/listinfo/freetds
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.