Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DBI mysql special characters

Status
Not open for further replies.

arvidus

Programmer
Sep 10, 2006
3
BE
when importing XML RSS into mysql tables, I use a perl script with DBI, XML:Simple, LWP, ...

the issue:

$description="György";

my $sth = $dbh->prepare( q{ INSERT INTO `testdb` (`description`) VALUES (?) });
$sth->execute($description);

after the scripts runs, in mysql table, I always get "György" instead of "György"??

I tried out all decode methods, but it is not working out; when I save the text directly via phpMyAdmin, no issue, so my sql table settings are ok ...
 
Thanks for your quick reply

I use:

print "Content-type:text/html\n\n";

would using another content type have a different effect on a DBI action to insert data into a mysql database? I thought the content type only applied to the browser output?

Arvid
 
Truthfully, I'm not really sure. But it might be something to try just in case.

The text/html should be fine, but you may want to try setting the charset. Maybe something like this?

Content-type:text/plain; charset=UTF-8

Blue Web Studios, LLC
 
I tried, but no change, in fact, when I print the $sql with data in it, it displays in the browser:

INSERT INTO `gentblogt` (`title`, `link`, `description`, `date`) VALUES ('Taxidermia', ' 'De Hongaar György Palfi ...', '2006-09-06 11:01:16') ON DUPLICATE KEY UPDATE `title`='Taxidermia', `description`='De Hongaar György Palfi ...', `date`='2006-09-06 11:01:16'

all data is perfectly inserted, but strange enough, the mysql table stored the full text as: "De Hongaar György Palfi ..."; the same happens to all special characters; the field in mysql is though latin1_swedish_ci, what never provided me a problem before ... and all use the à with another symbol: this looks like some kind of coding?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top