My task is to crawl the html code from the chinese webpage "http://emart.ttyy.net/big5.phtml
" and insert the html codes to column-"codes" of table-"testchi" of database-"buyingsearch".
The problem I face is that this homepage is encoded in UTF-8, but the mySQL database can't accept chinese in UTF-8 or "ugly code" would be shown. The database can only accept chinese words code in ANSI or Big5.
Is there any method for me to change the encoding from UTF-8 to Big5 in the PHP code before inserting $contents(the variable store the html code of the webpage) into the database?
Here is my code:
//fake the browser to read jsp
//connect to the servera & choose the database
$link_id = mysql_connect("localhost",
print "Successfully connected.<br>";
if (!$contents = implode('', file($website)))
mysql_query("insert into testchi(codes) values(\"$contents\");",$l
Really wanna get help....