Thanks again for the help. Apologies for the previous obscure "...this doesn't work." comment.

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?


In reply to Re^4: MS Access Input -> Japanese Output by Zettai
in thread MS Access Input -> Japanese Output by Zettai

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.