mainstreetop Posted February 23, 2010 Share Posted February 23, 2010 Not sure of this belongs in this php forum or in a mySql forum. I am trying to echo a field from a mySql database that contains a brand name with the 'registered' or 'trademark' symbol already stored. I'm using htmlentities($BrandName). The Registered symbols are displaying ok, but the Trademark symbol displays as a small, empty box. First, am I using htmlentities() properly? Second, does anyone know of why this would be happening? Thank you. Quote Link to comment Share on other sites More sharing options...
simshaun Posted February 23, 2010 Share Posted February 23, 2010 try htmlentities($field, ENT_COMPAT, 'UTF-8'); . If that doesn't work (and your database is set to utf-, you may need to use mysql_set_charset. Quote Link to comment Share on other sites More sharing options...
mainstreetop Posted February 23, 2010 Author Share Posted February 23, 2010 Thank you for responding so quickly. Unfortunatley, those parameters htmlentities($field, ENT_COMPAT, 'UTF-8'); would not display any brands that had any type of symbol. I did use this when initially parsing the XML (via XMLREADER) into the db: mysql_query("SET NAMES `utf8`"); So, I assume this addresses your second point? However, I'm not sure where/how ti use your final suggestion: use mysql_set_charset Of course, I should probably pose this issue in a mySql forum. Thanks for your help. Quote Link to comment Share on other sites More sharing options...
simshaun Posted February 23, 2010 Share Posted February 23, 2010 What charset is your database and table in? What charset is your page in? (<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />) I'm going to bet the answer to one of those is ISO-8859-1 or a variant. It does not contain the TM symbol. Quote Link to comment Share on other sites More sharing options...
mainstreetop Posted February 23, 2010 Author Share Posted February 23, 2010 What charset is your database and table in? CHARSET=latin1 What charset is your page in? (<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />) <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> I'm not terribly familiar with character sets but it looks like I'm incompatible here. Any idea where to make change? Quote Link to comment Share on other sites More sharing options...
simshaun Posted February 23, 2010 Share Posted February 23, 2010 Latin 1 = ISO-8859-1. Make your database and fields UTF-8. Its been a long time since I've had to convert charsets in the database, but it should be as simple as running a few queries. Check out http://www.haidongji.com/2008/11/11/convert-character-set-to-utf8-in-mysql/. Quote Link to comment Share on other sites More sharing options...
mainstreetop Posted February 24, 2010 Author Share Posted February 24, 2010 Thank you for the link. I will look into and see if it will work. I really do appreciate you taking the time to work with me on this. 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.