Search code examples
mysqlutf-8character-encodingphpmyadminlatin1

UTF8 & latin1 Character encoding in mysql 5.1


I'm using PHP Version 5.5.12 & Mysql Version 5.1 . Is the character encoding important in Mysql? Default character encoding in my phpMyAdmin is 'latin1_swedish_ci'. I have some latex and pdf file conversions. I found that Latex would be happy about UTF8 encoding. What is the difference between these file conversions? should I make any changes in mysql queries? How to change latin1 to utf8?

I'm Looking forward to guys... Thanks


Solution

  • The encoding is important is so far as it determines what characters you can store. You cannot save "日本語" or other similar "exotic" characters in a latin1 encoded column. If you may be required to do that, you'll have to choose an encoding for that column that can store those characters.

    Note that there's also the connection encoding. Any client that connects to the database (e.g. phpmyadmin, your own PHP scripts, a database admin utility, any application etc.) implicitly or explicitly specifies a connection encoding, which denotes what encoding that client would like to receive. You can have a latin1 encoded column and query data from it via a connection set to utf8 and MySQL will convert the data on the fly and give you utf8 encoded data nonetheless.