用perl从MSSQL查询出现中文乱码,求救!

用perl从MSSQL查询出现中文乱码,求救!

环境:RH9,DBD-0.91,freetds-0.51,DBI-1.38,MSSQL2K(另一台数据库服务器)

源码:

BEGIN
{
        $ENV{'SYBASE'}="/usr/local/freetds";
}

use DBI;

$SENDMAIL = '/usr/sbin/sendmail';
$LASTSENT = '/home/msgsndr/lastsentmsg';
$SERVERID = '005';
$sleepcoefficent = 0.01; ## SleepCoefficent -- Sleep Time (Seconds) / 1 mail

$dbh = DBI->;connect("DBI:Sybase:server=112db","xxx","xxxx"||die "cant connect $DBI::errstr";
$dbh->;do("use mailtest";
$dbh->;do("set textsize 80000";

$sql = qq!
                select mailjob.id,sourcename,mailsource,subject,mail,class
                from mailjob,mailcontent where mailjob.mailcontentid=mailcontent.id
                and mailjob.id in (select min(mainid) from mailjob_sub where status='U' and serverid='$SERVERID')
        !;
$sth = $dbh->;prepare($sql) ||die "Can't prepare $sql: $dbh->;errstr\n";
$rv = $sth->;execute or die "can't execute the query: $sth->;errstr\n";
print $rv;
my $maildata=$sth->;fetchrow_hashref();
$sth->;finish();
$mainid = $maildata->;{"id"};
$title = $maildata ->;{"subject"};
$source = $maildata ->;{"sourcename"};
print "$source\n";
print "$title\n";
exit;

$titel包含有中文与英文,中文部分出现乱码,请各位请点,不胜感激
原来在RH7.3下运行的好好点,移到RH9就不行了。

原来DBD为0。91的,freetds是0.51的


QUOTE:
原帖由 "zdlai" 发表:
原来在RH7.3下运行的好好点,移到RH9就不行了。

原来DBD为0。91的,freetds是0.51的

I think your linux box should have simplified chinese lang pakage installed.
我现在正在装另外一台RH9来做试验,呵呵。呆会见会晓
我把中文包装上了,也是不行呀,真没辙了,我快疯了
http://www.freetds.org/userguide/x1302.htm

你的freetds.conf 是怎么设置的?
[quote]原帖由 "zdlai"]我把中文包装上了,也是不行呀,真没辙了,我快疯了[/quote 发表:


Did you boot linux with the default lang of CHinese?

If your default lang is still ENG .it won't help.

I guess.

check.

env|grep LANG
和freetds.conf 这个有关系吗?我用的unixODBC也是只能显示问号,LANG=zh_CN.GB18030,用tsql可以,但是isql就是不能显示中文,应该怎么设置freetds.conf
这个问题有结果吗
还没有解决这个问题?