When using special characters in UTF-8 character encoding, sometimes when you read something from mysql database then it is not displayed properly on the web page. Many of you like me may try to change the character encoding of the HTML page to ISO-8859-1, that may work sometimes but this is not the proper solution to the problem.
Irrespective of the character encoding used by MySql to store the text data, when you query something using SQL it returns the data encoded in the latin charset. This is defined in the mysql config files, as described below:
The character_set_results system variable indicates the character set in which the server returns query results to the client. This includes result data such as column values, and result metadata such as column names.
To change the character encoding to UTF8 or other, you need to use “mysql_set_charset()” mysql function in PHP. Pass the correct encoding name required and now future mysql queries will return result using new encoding.
Search the site
Random Testimonial
- ~ Elance ID – ingariza
"This is the first time I used Elance, and I was blessed having Nirvaat as my provider, very professional, pro-active, great communication , on-time delivery, solve every problem I had. I recommend Nirvaat if you want your job on time, with quality and great support. Thanks" - Read more testimonials »
What's the little bird saying?
- Do u have an image and need a color scheme for your website around it. This is what u are looking for: http://www.degraeve.com/color-palette 2010-08-01
- Design a color scheme for your websites at: http://colorschemedesigner.com/ 2010-08-01
- New blog post: MySql Dump Using a PHP Script http://www.nirvaat.com/blog/web-development/mysql-dump-using-php-script/ 2010-07-25
- @pavanagrawal If computers will start asking questions then who will answer it!!!!! we have to creat a human version of google! in reply to pavanagrawal 2010-07-17
- Turn a USB Flash Drive Into Extra Virtual RAM [USB Drive] http://bit.ly/cb9fOT 2010-06-28
- More updates...
Posting tweet...

April 12, 2010 in