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 Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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.