Zettai has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: MS Access Input -> Japanese Output
by almut (Canon) on Nov 13, 2006 at 04:14 UTC | |
by Zettai (Acolyte) on Nov 23, 2006 at 12:21 UTC | |
by almut (Canon) on Nov 23, 2006 at 16:01 UTC | |
by Zettai (Acolyte) on Nov 23, 2006 at 17:23 UTC | |
by almut (Canon) on Nov 23, 2006 at 17:56 UTC | |
| |
|
Re: MS Access Input -> Japanese Output
by graff (Chancellor) on Nov 13, 2006 at 02:44 UTC | |
by Zettai (Acolyte) on Nov 13, 2006 at 03:20 UTC | |
by graff (Chancellor) on Nov 13, 2006 at 03:58 UTC | |
by Zettai (Acolyte) on Nov 13, 2006 at 12:46 UTC | |
by almut (Canon) on Nov 13, 2006 at 14:19 UTC |