in reply to Re^3: MS Access Input -> Japanese Output
in thread MS Access Input -> Japanese Output
Just so you know the environment I am using:
WinXP Professional Version 2002, Service Pack 2
Komodo Professional 3.5.3
perl, v5.8.8 built for MSWin32-x86-multi-thread
There is a lot more info if I use "perl -V" in a windows command prompt but not sure you want all that. Tell me if you do.
So this time I used:
binmode STDOUT, ":utf8"; 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"; my %code_map = ( euc => 'euc-jp', sjis => 'shiftjis', jis => 'iso-2022-jp', ucs2 => 'UCS-2LE', utf8 => 'utf8' ); my @row = $sth->fetchrow_array; my $eng = shift @row; # first field is English my $kana = shift @row; # second field is Kana my $kanji = shift @row; # third field is Kanji my $kana_enc = getcode( $kana ); my $kanji_enc = getcode( $kanji ); if ( $kana_enc ne $kanji_enc ) { warn "Very strange: kana is in $kana_enc, but kanji is in $kanji_e +nc\n"; } my $kana_utf8 = decode( $kana_enc, $kana ); my $kanji_utf8 = decode( $kanji_enc, $kanji ); printf( "English: %s Kana: %s Kanji: %s\n", $eng, $kana_utf8, $kanji +_utf8 );
I then changed to the directory where I have the program and ran it as:
perl reply2.pl > output.txt
Output:
------
English: Ah! Kana: ? Kanji: NA
So unfortunately there is still a question mark for anything in hiragana/kanji.
I have cygwin installed as well so I used the 'od' command you suggested as per:
od -txC output.txt
Output:
-------
0000000 45 6e 67 6c 69 73 68 3a 20 41 68 21 20 20 4b 61
0000020 6e 61 3a 20 3f 20 20 4b 61 6e 6a 69 3a 20 4e 41
0000040 0d 0a
0000042
I don't know what all these hex values mean. What do you think?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: MS Access Input -> Japanese Output
by almut (Canon) on Nov 13, 2006 at 14:19 UTC |