Insert UTF8 into mysql from perl

I have a web form that I need to insert into a mysql table.  I am struggling to understand what I need to do.  given the code below, what step am I missing?  I've tried Encode::encode('utf8', ...), utf8::upgrade, and some others and nothing seemed to have the right effect

form script :

$someVar='test îøoppñåaéá'; (contains UTF-8 string from form)

Module::StoreToDB($dbh, $someVar);



Module:

sub StoreToDB {
     my $dbh=shift;
     my $var=shift;
	$dbh->do(q{SET NAMES utf8});
	$dbh->do(q{INSERT INTO someTable SET col=?}, undef, ($var));
  return;        
};





Table SQL:
CREATE TABLE `someTable` (
  `col` tinytext CHARACTER SET utf8 COLLATE utf8_bin,
) ENGINE=InnoDB AUTO_INCREMENT=28232 DEFAULT CHARSET=utf8

Open in new window

rperry_whaAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Fairlight2cxConnect With a Mentor Commented:
Are you sure that MySQL is even set up for UTF8?  There's support available for some subsets of the standard, although not all.  It seems to me that if you're confident in the perl side doing what it should be doing, perhaps the MySQL side is either not configured for UTF8, or does not support the necessary encoding style.  Check this documentation for details:

http://dev.mysql.com/doc/refman/5.0/en/charset-unicode.html
0
All Courses

From novice to tech pro — start learning today.