Jump to content

[SOLVED] Problem with font display / charset


tmyonline

Recommended Posts

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.

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.