tmyonline Posted September 11, 2009 Share Posted September 11, 2009 Guys, I'm not exactly sure whether this problem can be resolved using MySQL or PHP but here it is: The content of my site is in Vietnamese. I need to store the Vietnamese data in MySQL. So in MySQL, I set the Collation to utf8_general_ci and the Vietnamese language appears fine in MySQL. However, when I perform database query and display these data on the browser, they appear corrupted. In the meta tag of the html DOCTYPE declaration, I set "charset=utf-8". Any ideas ? Thanks. Link to comment https://forums.phpfreaks.com/topic/173953-solved-problem-with-font-display-charset/ Share on other sites More sharing options...
corbin Posted September 11, 2009 Share Posted September 11, 2009 http://www.phpfreaks.com/forums/index.php/topic,267835.msg1264718.html#msg1264718 That's about Japanese, but it's essentially the same. You need to make sure the connection to the database is UTF8 by issuing a SET NAMES 'utf8'; query. Then, you'll need to tell user's browsers to render the content as UTF-8 by sending a header like the one in the link. Link to comment https://forums.phpfreaks.com/topic/173953-solved-problem-with-font-display-charset/#findComment-916958 Share on other sites More sharing options...
tmyonline Posted September 12, 2009 Author Share Posted September 12, 2009 Thanks corbin, it worked. But, now I'm having another related problem. I have written some PHP code to handle document upload. Because the document file names are in Vietnamese, after the uploading process is complete, the font in the filenames got corrupted. I have used PHP "echo" command to track the errors. What I found is that: // filename appeared fine here - just before the move_uploaded_file() gets executed move_uploaded_file($_FILES['doc_' . $i]['tmp_name'], $uploadPath); Once the move_uploaded_file() got executed, I checked the document in the uploaded folder, it did get uploaded but, now, its filename got corrupted. Any ideas ? Thanks. Link to comment https://forums.phpfreaks.com/topic/173953-solved-problem-with-font-display-charset/#findComment-917049 Share on other sites More sharing options...
tmyonline Posted September 13, 2009 Author Share Posted September 13, 2009 Thanks a lot guys, especially corbin, for your great help. It works Link to comment https://forums.phpfreaks.com/topic/173953-solved-problem-with-font-display-charset/#findComment-917448 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.