Jump to content

[SOLVED] Problem with font display / charset


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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.