he i have a problem
i have a mysql database dump, but all the data is url encoded has + instead of spaces and other characters as %20 etc
i tried to import this directly and wrote a php script to decode the data and rewrite it back to the db,
/// make rs..........
........
do {
// decode the items in the countries table
$myCountryID = $row_countries['id_con'];
$new_country_con = urldecode($row_countries['country_con']);
$result = mysql_query("UPDATE countries_con SET country_con = '".$new_country_con."'
WHERE id_con = ".$myCountryID."")or die(mysql_error()) ;
echo("id_win: ".$myCountryID."<br>added country_con: ".$new_country_con."<br>");
} while ($row_countries = mysql_fetch_assoc($countries));
echo('--------------------开发者_Python百科--------------END Countries-------------------------------------<br><br>');
the page is set to use utf8 all the tables in the db are set to use utf8
the echo statement outputs the correct characters, but it still gets stored in the db as a urlencoded string, how do i get it into the db as utf8 without the url encoded characters?????
Try to printout your query to see at which point it produces %20 (before query execution or after).
Also please see: http://recursive-design.com/blog/2008/06/23/force-mysql-encoding-to-utf8/
精彩评论