Re: Mac OSX FreeTDS 0.8.3dev Unexpected EOF from the server

Luciano Pacheco <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
On Fri, May 7, 2010 at 10:58 AM, Craig A. Berry <[email protected]> wrote:

>
> On May 6, 2010, at 11:48 PM, Luciano Pacheco wrote:
>
> > Hi,
> >
> > I'm trying connect from Mac OSX Leopard with FreeTDS to a MSSQL 2000
> > MSDE,
> > and I'm getting this error:
> >
> > [01:40:09] $ /usr/local/bin/tsql  -S MACLUCK -I
> > /opt/local/etc/freetds/freetds.conf  -U lucianopacheco -D
> > dbServicos  -P
> > <password snipped>
> > locale is "pt_BR.utf-8"
> > locale charset is "utf-8"
>
> I think that's your problem right there.  How is this locale set?  Do
> you have LANG in your environment?  What do you get from:
>
> % locale -a | grep  pt_BR
> pt_BR
> pt_BR.ISO8859-1
> pt_BR.UTF-8
>

The same output.

(that's what I see on my Leopard system).  If yours is anything like
> mine, pt_BR.UTF-8 is a valid locale setting, but pt_BR.utf-8 is not.
>

I did:
$ export LANG=pt_BR.UTF-8
$ export LC_COLLATE=pt_BR.UTF-8
$ export LC_CTYPE=pt_BR.UTF-8
$ export LC_MESSAGES=pt_BR.UTF-8
$ export LC_MONETARY=pt_BR.UTF-8
$ export LC_NUMERIC=pt_BR.UTF-8
$ export LC_TIME=pt_BR.UTF-8

$ set  |grep -i utf
LANG=pt_BR.UTF-8
LC_COLLATE=pt_BR.UTF-8
LC_CTYPE=pt_BR.UTF-8
LC_MESSAGES=pt_BR.UTF-8
LC_MONETARY=pt_BR.UTF-8
LC_NUMERIC=pt_BR.UTF-8
LC_TIME=pt_BR.UTF-8

How can I setup this in OSX ? .bash_profile ?

 > 01:45:08.194206 76313 (iconv.c:364):setting up conversions for client
> > charset "utf-8"
> > 01:45:08.194215 76313 (iconv.c:366):preparing iconv for "utf-8" <->
> > "UCS-2LE" conversion
> > 01:45:08.194237 76313 (iconv.c:442):tds_iconv_info_init: client
> > charset name
> > "" unrecognized
>
> FreeTDS knows what to do with UTF-8 (upper case) but not (utf-8) lower
> case.
>

Now works! :-)

11:20:01.979689 740 (iconv.c:364):setting up conversions for client charset
"UTF-8"
11:20:01.979698 740 (iconv.c:366):preparing iconv for "UTF-8" <-> "UCS-2LE"
conversion
11:20:01.979723 740 (iconv.c:407):preparing iconv for "ISO-8859-1" <->
"UCS-2LE" conversion
11:20:01.979745 740 (iconv.c:410):tds_iconv_open: done

Maybe FreeTDS can fail more gracefuly when this happen, because the error
reported on command line is far from helpful. What do you think about it ?


>  > What else can I try ?
>
> Try fisql or see my tsql.c patch in the archives from a week or so
> ago.  There's still a bug or two that need to be fixed regarding
> overriding the system default character set, but getting yourself into
> a position where you don't need an override is probably your best bet.
>

Here is the patch:
http://lists.ibiblio.org/pipermail/freetds/attachments/20100430/244dd8a5/attachment.obj

I will try the patch with more time.

I read the patch and don't understand why use ISO-8859-1 as default
encoding, AFAIK the best choice today is use the UTF-8, that can handle more
use cases, but I'm very new to freetds.

Thanks by your fast feedback! :-)
-- 
Luciano Pacheco
blog.lucmult.com.br
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.