» tagged pages
» logout

sorted by: recent | see : popular
Content Tagged with set + MySQL

French Characters Not Rendering Correctly

Background Knowledge
The MySQL database v4.0.23 is using the default character set of “Latin1″. When the database was created I had no knowledge of character sets other wise it would have been “UTF-8″.
The web pages are using a character set of “UTF-8″.

Problem
Data being queried from a MySQL database that contains French accent characters will not render correctly in the browser even after applying PHP htmlentities().

Example code: $string = htmlentities($string , ENT_QUOTES, “UTF-8″);

Solution
The queried data from the database was inputted using the character set “ISO-8859-1″. I found this out by changing the browser’s character encoding to “Western ISO-8859-1″ and the French accent characters then rendered properly. With the use of PHP iconv() I was able to convert the data from “ISO-8859-1″ to “UTF-8″ character set and the French characters then rendered properly in the browser.

Example code: $string = iconv(”ISO-8859-1″,”UTF-8″,”$string”);


If you are unaware of what MySQL default character set being used, you can run this SQL command “show variables like “%character%” and check your MySQL configuration file. Refer to the MySQL manual for further details.

MySQL: Planet MySQL

MySQL - Sending Non-ASCII Text to MySQL

This chapter provides tutorial notes on sending non-ASCII text data to MySQL. Topics include sending non-ASCII text data in SQL statements; changing MySQL character set settings to send Latin1, UTF-8, BGK, and Big5 characters.

User:mark1048: Building Chinese Web Sites using PHP

MySQL - Character Set and Encoding

This chapter provides tutorial notes on character set and encoding in MySQL. Topics include defining text columns with specific character set encodings; encoding conversions performed by MySQL on SQL statements and result sets; fetching non-ASCII characters in UTF-8 encoding.

User:mark1048: Building Chinese Web Sites using PHP