jggretton Posted December 28, 2008 Share Posted December 28, 2008 Hi all, I'm a reasonably experienced PHP developer however I keep on getting caught short by character encoding problems - e acutes in xml, pound signs from WYSIWYG editors, Mac characters Vs PC characters etc etc... I was hoping that someone might know of a good online guide (or book if necessary) which can teach me the basics and build up from there? I've spent a few hours doing Google searches but haven't found anything that clearly covers everything i need. Any recommendations would be greatly appreciated. Many thanks, James Link to comment https://forums.phpfreaks.com/topic/138609-guide-to-character-encoding-in-html-php-mysql/ Share on other sites More sharing options...
jggretton Posted December 29, 2008 Author Share Posted December 29, 2008 Sorry to bump up, but was hoping someone might have a suggestion? Thanks, James Link to comment https://forums.phpfreaks.com/topic/138609-guide-to-character-encoding-in-html-php-mysql/#findComment-725322 Share on other sites More sharing options...
jggretton Posted December 29, 2008 Author Share Posted December 29, 2008 Hello, in case anyone else comes across this question themselves, I did find a very useful article here: http://www.sitepoint.com/article/guide-web-character-encoding/ Backed up by a forum post here: http://www.sitepoint.com/forums/showthread.php?t=450442&page=1 (ignore the comments by the ranting bloke though) Any other good articles would be appreciated! Thanks, James Link to comment https://forums.phpfreaks.com/topic/138609-guide-to-character-encoding-in-html-php-mysql/#findComment-725370 Share on other sites More sharing options...
Mchl Posted December 29, 2008 Share Posted December 29, 2008 I just use utf-8 everywhere, so my checklist is as follows 1. Database tables 2. PHP sources 3. HTTP headers 4. HTML encoding declarations 5. PHP - MySQL connection 6. XML files (these should always be utf-8 as per standard) I just make sure all of these are utf-8 and things work. Link to comment https://forums.phpfreaks.com/topic/138609-guide-to-character-encoding-in-html-php-mysql/#findComment-725452 Share on other sites More sharing options...
jggretton Posted December 30, 2008 Author Share Posted December 30, 2008 Ah, thanks Mchl. That's certainly the stage I've now got to - make it UTF-8 and stop worrying about it! You have pointed out one bit which I previously missed (which is very important): Point 5. PHP - MySQL connection. I will have a play with this now. Thanks for your help, James Link to comment https://forums.phpfreaks.com/topic/138609-guide-to-character-encoding-in-html-php-mysql/#findComment-726086 Share on other sites More sharing options...
Mchl Posted December 30, 2008 Share Posted December 30, 2008 mysql_connect("localhost","username","password"); mysql_query("SET NAMES 'utf8'"); //make sure you run this query after connecting to server That takes care of that. Link to comment https://forums.phpfreaks.com/topic/138609-guide-to-character-encoding-in-html-php-mysql/#findComment-726123 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.