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. Link to comment https://forums.phpfreaks.com/topic/193142-retrieve-trademark-symbol-from-mysql-database/ 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. Link to comment https://forums.phpfreaks.com/topic/193142-retrieve-trademark-symbol-from-mysql-database/#findComment-1017082 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. Link to comment https://forums.phpfreaks.com/topic/193142-retrieve-trademark-symbol-from-mysql-database/#findComment-1017085 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. Link to comment https://forums.phpfreaks.com/topic/193142-retrieve-trademark-symbol-from-mysql-database/#findComment-1017091 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? Link to comment https://forums.phpfreaks.com/topic/193142-retrieve-trademark-symbol-from-mysql-database/#findComment-1017100 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/. Link to comment https://forums.phpfreaks.com/topic/193142-retrieve-trademark-symbol-from-mysql-database/#findComment-1017102 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. Link to comment https://forums.phpfreaks.com/topic/193142-retrieve-trademark-symbol-from-mysql-database/#findComment-1017127 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.