Do Win32::ODBC module support Chinese characters when used with MS Access?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Hello all,

I am a newbie to Perl & CGI (7 days).

I am using Perl 5.6 and using Win32::ODBC to connect to an MS Access
Database, where I do my Insert/Update/Delete.

I found that I can't correctly update a field's value to data
containing Chinese characters. The field's value become a mess after
running the SQL.

The value is submitted from an HTML form to this CGI. To verify, I
printed out the SQL statement to the output and I can see the correct
Chinese Chars been shown for the SQL statement. (Relevant codes given

Then I run the sql using


No errors, but the related field now contains unreadable chars.

I tried to insert a Chi. Char having charcode = 0xA4A4
Inserted, and when I get back the value of the updated field,
the char becomes 0x3F3F, which would be a mess using ASP and Access.
And there's no linear relation between to charcodes.

Would anyone help me on this?

Thank You!


=========CODES BELOW=================
# Form-Data are put in Hash called %in. cwr contains Chinese chars.
  my $value = $in;
  my $rv = "";
  if (defined($value)) {
    if (length($value) > 0) {
      for ($ic=0;$ic<length($value);$ic++) {
        $px = unpack("c", substr($value, $ic, 1));
        if ($px < 0) {
          $py = unpack("c", substr($value, $ic, 1));
          $px = $px + 256;
          $py = $py + 256;
          $px = $px * 256 + $py - 65536;
          $rv .= pack("c", $px);
        elsif (($px == 34) || ($px == 39)) {        #make
SQL-Compatible string
          $rv .= pack("C", $px) . pack("C", $px);
        else {
          $rv .= pack("C", $px);
        print "$px, ";
      print "<br>[".$rv."]<br>";
      $rv = "'" . $rv . "'";          #Single-Quote it
    else {
      $rv = "NULL";
  else {
    $rv = "NULL";
  print $rv;                           <---OK
  my $SQLCMD = "update Restaurants set ChiName = " . $rv . " where Id
= 1";
  print $SQLCMD;                       <---Also OK

  $db->Sql($SQLCMD);                   <---Also OK

(Get back to ASP reading the database about this data, and found the
field contains messy data)

Site Timeline