x_maras Posted October 23, 2009 Share Posted October 23, 2009 Hi, I'm making a script and I m using for first time greek characters. I started to write a simple drop down menu that loads some city names from the database. The names are in Greek in the database and the database is set in utf8_general_ci, but in the drop down was appearing only some "?????????" question marks. I also add this in the code in the head part <meta http-equiv='Content-Type' content='text/html; charset utf-8'/> and finally I added this in the file I make the connection with the database mysql_query("SET NAMES 'utf8'", $conn); after the final addition the characters changed from question marks and now the drop down appears like this I think I m close to solve it, but probably I m missing something. If anyone knows something I would appreciate it. Thank you in advance! Quote Link to comment https://forums.phpfreaks.com/topic/178788-greek-characters-in-php/ Share on other sites More sharing options...
RickXu Posted October 23, 2009 Share Posted October 23, 2009 You may try change the character set to utf8 and collation to utf8_unicode_ci Change both settings for the specific table and field. Quote Link to comment https://forums.phpfreaks.com/topic/178788-greek-characters-in-php/#findComment-943181 Share on other sites More sharing options...
MadTechie Posted October 23, 2009 Share Posted October 23, 2009 Infact utf8_general_ci does support Greek & Greek Extended <meta http-equiv='Content-Type' content='text/html; charset utf-8'/> should be <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> also along with mysql_query("SET NAMES 'utf8'", $conn); add mysql_query("SET CHARACTER SET utf8", $conn); Quote Link to comment https://forums.phpfreaks.com/topic/178788-greek-characters-in-php/#findComment-943218 Share on other sites More sharing options...
x_maras Posted October 24, 2009 Author Share Posted October 24, 2009 also along with mysql_query("SET NAMES 'utf8'", $conn); add mysql_query("SET CHARACTER SET utf8", $conn); 1000 thanks!!! after adding this it worked! Thanks again! :D Quote Link to comment https://forums.phpfreaks.com/topic/178788-greek-characters-in-php/#findComment-943238 Share on other sites More sharing options...
x_maras Posted October 24, 2009 Author Share Posted October 24, 2009 My new problem now is when I insert the some data to the database then they are inserted like ???????. my php files are utf8? Quote Link to comment https://forums.phpfreaks.com/topic/178788-greek-characters-in-php/#findComment-943439 Share on other sites More sharing options...
MadTechie Posted October 24, 2009 Share Posted October 24, 2009 Hummm, inserting or viewing ? what are you using to view the data ? remember your need to use mysql_query("SET CHARACTER SET utf8", $conn); right after your connection to the database, (so its used before every query) Quote Link to comment https://forums.phpfreaks.com/topic/178788-greek-characters-in-php/#findComment-943460 Share on other sites More sharing options...
x_maras Posted October 24, 2009 Author Share Posted October 24, 2009 Hummm, inserting or viewing ? what are you using to view the data ? remember your need to use mysql_query("SET CHARACTER SET utf8", $conn); right after your connection to the database, (so its used before every query) Thanks for all the help. Actually I uploaded the files that do the insert in my webhost and it inserts properly the data. The problem was only in my localhost (working on wamp). Can the the problem be in the settings of the database in my localhost? Quote Link to comment https://forums.phpfreaks.com/topic/178788-greek-characters-in-php/#findComment-943481 Share on other sites More sharing options...
MadTechie Posted October 24, 2009 Share Posted October 24, 2009 Can the the problem be in the settings of the database in my localhost? Yes it could be, Are you using a full install of Apache and PHP and MySQL or a cut down version ie WampServer (Formerly WAMP5) 2.0e Quote Link to comment https://forums.phpfreaks.com/topic/178788-greek-characters-in-php/#findComment-943486 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.