U+ fffd character is inserted in MySQL from PERL?

Jacques Fourie

New member
I'm using PERL to create a website and manage a database but inserting a new row from PERL adds the U+ fffd character at the end of each line.
Adding a new entry from PHPMyAdmin does not insert the character.

Any suggestions on how to fix this will be highly appreciated!
#########################
# Add Interface#
#########################

print &HTMLHeaderTitle("$NAME_TITLE{'common_admin'}<BR>Interface");
print "<CENTER><FORM METHOD=post><INPUT TYPE=HIDDEN Name=ac VALUE=$action><INPUT TYPE=HIDDEN Name=login VALUE=$login><INPUT TYPE=HIDDEN Name=pass VALUE=$password><TABLE BORDER=0>\n";

# Insert new element

use DBI;
#use DBD::mysql;
my $dbh = DBI->connect('dbi:mysql:router_db','admin','admin') or die "Connection Error: $DBI::errstr\n";


# CONFIG VARIABLES
$tablename = "router_data";

# PREPARE THE QUERY
$name_set = $dbh->prepare("SET NAMES 'utf8'");
$name_set->execute();
$dbh->{'mysql_enable_utf8'}=1;

$query = "INSERT INTO
$tablename (RouterA, PortA, TypeA, RouterB, PortB, TypeB, Bandwidth, User, Time)
VALUES ('$a','$porta','IP', '$b', '$speedb-$portb', 'ME', '$band', '$login', NOW())";
$query_handle = $dbh->prepare($query);
# EXECUTE THE QUERY

if (($input{'routerB'} =~ /^N....C../i) and ($input{'portB'} =~ /[0-1][0-9]\-[0
 
Back
Top