PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: "Ruth S dot McNay" <ruthmcnay at aol dot com>
Subject: UTF8 problems
Date: Aug 31 2001 8:17PM

Michael, 

I'm having utf8 problems.

I am connecting with - 

if (defined($sybcharset)) {
    $dbh = new Sybase::CTlib $dbuser,$passwd,$server,$myname,
                             { CON_PROPS => { CS_HOSTNAME => "$hostname"},
                                            { CS_SYB_CHARSET => "$sybcharset"}};
    print LOG "using SYB CHARSET $sybcharset\n";

} else {
  $dbh = new Sybase::CTlib $dbuser,$passwd,$server,$myname,
                         { CON_PROPS => { CS_HOSTNAME => "$hostname"}};  
}

and my log says "using SYB CHARSET utf8".

I have Japanese characters converted to UTF8 in my server and I am
trying to get them out.

I'm running a stored procedure that does a select at the end.  


$sql = "exec $storedproc";
&log($sql);
$status = $dbh->ct_execute($sql);
my($siteId,$location,$empid,$name,$supid,$sdmid,$empstatus);
while (($status =$dbh->ct_results($restype)) == CS_SUCCEED) {
    next if($restype == CS_CMD_FAIL || 
            $restype == CS_CMD_SUCCEED);
    
    if ($restype == CS_CMD_DONE) { 
            $rowcount = $dbh->ct_res_info(CS_ROW_COUNT); # get rowcount of
select, insert, delete
        #   &log("Rows Deleted From $table: $rowcount") if $status ==
CS_SUCCEED;
        next;
    }
    if ($restype == CS_STATUS_RESULT) { # get status of stored procedure
        $procstatus = $dbh->ct_fetch;
    }
    
    # Skip non-fetchable results
    next unless ($dbh->ct_fetchable($restype));
    
    #       Retrieve actual data rows
    while (@results = $dbh->ct_fetch) {
        #    push(@acctset, join("$ctrla",@results))
        #    print "@results \n";
        #Location,Employee_Id,EmployeeName,Supervisor_Id,SDM_Id,Emp_Status
        # 0       1           2            3             4      5
        
        ($siteId,$empid,$name,$supid,$sdmid,$empstatus) = trim(@results);
        $name =~ s/ //g;
        $supid = '.' if (!(defined($supid)));
        $sdmid = '.' if (!(defined($sdmid)));
        print FTPF join("|",$siteId,$empid,$name,$supid,$sdmid,$empstatus) .
"\n";
        $rowsprocessed++;
                
    }
}
errexit("Exiting:status is CS_FAIL after $sql") if ($status == CS_FAIL); 


And I write the results to a file.

The file does not have UTF8 characters in it.  It acts like I got iso
back...

50|5|??|??|.|101|FULL
50|6|??|??|.|101|FULL


Any ideas of what is wrong...  I just want to get the utf8 characters
out and put them in a file.

If I use sqsh and connect -J utf8, I see the following:
50           5 夫|      NULL         101 FULL     
50           6 | 岩     NULL         101 FULL     

-- 

****************************************************************
Ruth S. McNay                        
America Online                      520-514-3408 office
5401 East Williams Blvd             520-514-3194 fax
Tucson, AZ 85711                    RuthMcNay@aol.com