# Select a component that I know has non-utf8 data in the title field. my $sql = "select name, title from components where name = 'xaf'"; my $result = $dbh->selectrow_arrayref($sql); die "no result" unless $result and scalar(@$result); print("name=$result->[0], title=$result->[1]\n");

# I cut and paste the title into a Perl string, but cannot use it # to match the database result. That's probably ok. print "can't match non-utf8 perl string by cut-and-paste!\n" unless $result->[1] eq "xaf\u9879\u76EE\u96C6\u5408(CRM,ERP,OA,SCM)--qq:651922596";

# I assign the result from the db to a Perl var. Whew! It does match itself in Perl, at least. my $title = $result->[1]; print "can't match non-utf8 perl string assigned to a local var!\n" unless $result->[1] eq $title;

# However, the Perl string does NOT work as a SQL query. $sql = "select name, title from components where title='$title'"; $result = $dbh->selectrow_arrayref($sql); print "Can't match db non-utf8 data after retreival to a perl string\n" unless $result and scalar(@$result);