MySQL, Perl and HTML

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

Threaded View
Hi there,

I am fighting with my MysQL database in order to get french and
cyrillic characters properly displayed on my website. I've created
tables with latin1 charset. My Perl script on the webserver worked fine
until I have added Unicode support. I saved the script file in Unicode
UTF-8 format, and added

Content-type: text; charset=3Dutf-8/html\n\n
<META HTTP-EQUIV=3D"CONTENT-TYPE" content=3D"text/html; charset=3Dutf-8">

to print the HTML headers. Now I can display french _and_ cyrillic
characters, which are stored in strings inside the script.
Unfortunately the strings coming from my MySQL database via DBI are no
longer displayed properly on the website. Characters like
=E9 (&eacute) are displayed as chinese or so.

I was reading many postings and I tried many things like
encode:decode("utf8", $string) in my Perl script and "SELECT
CONVERT(data USING utf8) AS data1 FROM test;" to select data from the
database, but still I'm not able to solve the problem.

I found out that the strings inside my script are UTF-8 coded, but the
string I get from the tables are not.

Can anybody help getting this thing working?

Thanks in advance
Andi Pfaff

Re: MySQL, Perl and HTML

Sorry, I forgot the environment:
Win 2k, Perl 5.87, MySQL 4.1.13a for Win32, DBD-mysql 2.9003, DBI 1.46

hope that helps

Site Timeline