JasonLewis Posted May 8, 2011 Share Posted May 8, 2011 So I've recently started looking into Character Encoding, after never really bothering with it, and I've got a few questions. After checking out my site it seems I've been using UTF-8 without really realising it, and I'm going to stick with UTF-8. However, when I jump into phpMyAdmin to check out my MySQL tables I run into a few problems. Originally, for my database, the collation was set to latin1_swedish_ci. I have since changed this to utf8_general_ci. This however only affects newly created tables, not the 150 or so tables I currently have which are still latin1_swedish_ci. Do I need to convert the collation of these already existing tables to UTF-8, and if so what's the best method? This takes me to my text editor, NetBeans 7. Do I need to alter anything here, I've not been successful with finding information relating to this? Cheers guys. Quote Link to comment https://forums.phpfreaks.com/topic/235823-character-encoding-and-steps-i-should-take/ Share on other sites More sharing options...
Zane Posted May 8, 2011 Share Posted May 8, 2011 ALTER TABLE tbl_name CONVERT TO CHARACTER SET utf8; http://yoonkit.blogspot.com/2006/03/mysql-charset-from-latin1-to-utf8.html Quote Link to comment https://forums.phpfreaks.com/topic/235823-character-encoding-and-steps-i-should-take/#findComment-1212231 Share on other sites More sharing options...
JasonLewis Posted May 8, 2011 Author Share Posted May 8, 2011 Right... and this must be done for every column which has a latin1 collation too? Crap, that's a lot of work... Quote Link to comment https://forums.phpfreaks.com/topic/235823-character-encoding-and-steps-i-should-take/#findComment-1212233 Share on other sites More sharing options...
scanreg Posted July 23, 2012 Share Posted July 23, 2012 Will this safely convert all existing data, or is this just for inserting new data? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/235823-character-encoding-and-steps-i-should-take/#findComment-1363677 Share on other sites More sharing options...
xyph Posted July 23, 2012 Share Posted July 23, 2012 It depends on your old charset. UTF-8 is backwards compatible with ASCII, so it generally isn't an issue if converting from that. Quote Link to comment https://forums.phpfreaks.com/topic/235823-character-encoding-and-steps-i-should-take/#findComment-1363685 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.