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 PHP or MySQL 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.  However, when I perform database query and display these data on the browser, they appear corrupted.  In my HTML DOCTYPE declaration, I set "charset=utf-8".  Any ideas ?  Thanks.

I think you are supposed to set the charset in a meta tag, not the doctype declaration, like so

 

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 

 

but I could be wrong. just did a google search and this line of code came up in one of the pages

Did you store the MySQL link identifier returned by mysql_connect() in $connection prior to running the queries? A last thing to try could be to set the header:

 

header('Content-type: text/html; charset=utf-8');

If it still doesn't work, I don't know what to tell you. It should work if you do the things right that you and I have outlined.

Thanks thebadbad, 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.