use DBI; use Encode; use Jcode; my $dbh = DBI->connect('DBI:ODBC:japan','','') or die "Cannot connect: + $DBI::errstr\n"; my $sth = $dbh->prepare('Select English, Kana, Kanji from Vocab') or die "Cannot prepare: $DBI::errstr\n"; $sth->execute or die "Cannot execute: $DBI::errstr\n"; @row = $sth->fetchrow_array(); print("@row\n"); $i=0; foreach $i (@row) { print(getcode($i), "\n"); $i++; } my $ustring = decode( 'ascii1', $row[2] ); print("My ustring is now $ustring\n"); #$dbh->disconnect;
So I get a question mark when I try to print the Hiragana and Kanji (for subsequent rows). I used Jcode hoping to see in what form the perl program receives the information. But if feels like I am doing this part wrong. Don't I need to check the data before it enters the perl structure? Even if I did this part right the encoding looks strange as per 'ascii1'. But if I change it to just 'ascii' then my output is this:Output1: ---------- Ah! ? NA ascii1 ascii1 ascii1 Unknown encoding 'ascii1' at ... line 22.
I have no idea how this all works. Can someone please help me use Jcode correctly so I can see how the program receives the data from MS Access and also how to then print out the hiragana or kanji correctly to the screen? Thanks very much for your time.Output2: --------- Ah! ? NA ascii1 ascii1 ascii1 My ustring is now 1.
In reply to MS Access Input -> Japanese Output by Zettai
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |