fohanlon Posted December 6, 2007 Share Posted December 6, 2007 Hi Can anyone point out a solution to my problem I have built a cms where a user can all in content. The content can contain euro symbols and accented and they get stored ok in a text field in the mysql table. The table is set as utf-8-general-ci. As i read that thsi was the best for storing all symbols. Problem is when the select in done in a web page to view the content the characters are appearing as square boxes. Is there comething like htmlspecialchars I should be running on the content to fix this output? Many thanks, Fergal. Quote Link to comment Share on other sites More sharing options...
effigy Posted December 6, 2007 Share Posted December 6, 2007 Charset Connection. Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted December 6, 2007 Share Posted December 6, 2007 I have actually had a similar problem before, and I solved it making my own escape phrases sorta like xhtml has or " I just made stuff like € or &passo; and then I did a replace on the output and altered all inputers to use this. Quote Link to comment Share on other sites More sharing options...
fohanlon Posted December 6, 2007 Author Share Posted December 6, 2007 Thanks effigy How would this work in a mysql select statement? Fergal. Quote Link to comment Share on other sites More sharing options...
effigy Posted December 6, 2007 Share Posted December 6, 2007 I have actually had a similar problem before, and I solved it making my own escape phrases sorta like xhtml has or " I just made stuff like € or &passo; and then I did a replace on the output and altered all inputers to use this. Not a good idea. Everything will work as-is if everything is UTF-8. Thanks effigy How would this work in a mysql select statement? Fergal. http://www.phpfreaks.com/forums/index.php/topic,159313.msg694931.html#msg694931 Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted December 6, 2007 Share Posted December 6, 2007 this was before you had to name a collation in mysql Quote Link to comment Share on other sites More sharing options...
fohanlon Posted December 6, 2007 Author Share Posted December 6, 2007 Thanks Guys for all the comments. Effigy I placed your after my connection to database and before my select sql statement and it worked. mysql_query("SET CHARACTER SET utf8"); mysql_query("SET NAMES utf8"); Many thanks, Fergal. 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.