(Previous sending failed for some reaseon!)

Hello,

I suppose i am not the only one who has got that problem about transferring
site
database to MySQL 4.1x and to utf8 charset. Before it was MySQL 3.23 and
latin1.
I have read this article "Turning MySQL data in latin1 to utf-8" on
http://www.oreillynet.com/lpt/wlg/9022, but it is way to long and
complicated to me (it took Mr. Derek Sivers 60 hours over 5 days). And
besides that, i have problems because i dont have control over my web server
or db server and db is pretty large for export and re-import it. On the top
of all, i have dial-up connection and phpMyAdmin scripts interrupt after 30
seconds (server is in safe mode so i cant increase execution time)

I tried to do some conversion using generic php script (convert field values
with utf8_decode). Problem is that conversion from latin1 to utf8 doesnt
work correctly (some characters are lost, others are badly converted to some
non characters). My text in the db was input in utf-8 cyrilic (PHP-Nuke as
CMS), but it seems mysql stored it in latin1 and php somehow managed to show
correctly encoded text.
There is also some amount of my confusion and ignorance about how php
handles mysql latin1 encoding and shows correctly encoded text.
When i do this

header("Content-Type: text/html; charset=utf-8");
// pseudo code
connect_mysql($my_params);
mysql_query("SET NAMES 'utf8'", $link) or die("Error setting names to utf");
mysql_query("SET CHARACTER SET 'utf8'", $link) or die("Error setting
connection charset");
select_row($my_query);
echo $row["column"];
i got jumbled output text

if i do this
mysql_query("SET NAMES 'latin1'", $link) or die("Error setting names to
utf");
mysql_query("SET CHARACTER SET 'latin1'", $link) or die("Error setting
connection charset");
or just omit these lines (php is connecting default in latin1) - my texts
are correctly encoded on html output.

So, i would like somehow to export my tables to real utf8 file and then try
to use LOAD INFILE for importing the contents of the tables. If php can show

correct contents in html using latin1, i think it is possible to export it
to plain utf file.
This is my question - does anyone know how to do it in php?

--
Pozdrav,
Radovan Radic

--
Pozdrav,
Radovan Radic

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to