Jax2 Posted June 16, 2010 Share Posted June 16, 2010 Hi all, I am working on a small game project for a league I am in and I'm running into an issue. The game allows players to use alt-code ascii characters for their names should they wish to, and I'm trying to track players names. I have a player, for example, Διόνυσ ... I have the name stored as is in the database, but if I go to echo it later on, I simply get ????? instead of the name. This will be a problem, as other players will type Διόνυσ into the search box to find that player. So, I need to figure out how I can set it up so I can enter that name into search, have it find it in the SQL and then display the name correctly on the next page. Any suggestions? Link to comment https://forums.phpfreaks.com/topic/204973-need-help-with-special-characters/ Share on other sites More sharing options...
shadiadiph Posted June 16, 2010 Share Posted June 16, 2010 Save the file in utf-8 format do not use word pad to do this use a program like pspad wordpad does not work for some reason. Also make sure your doc type character encoding is utf-8 Link to comment https://forums.phpfreaks.com/topic/204973-need-help-with-special-characters/#findComment-1073090 Share on other sites More sharing options...
Jax2 Posted June 16, 2010 Author Share Posted June 16, 2010 I am not using any files ... the name is stored as is, directly in my database Διόνυσ ... I am using: echo $row['player_name']; to retrieve the names from the database, and all works fine until it comes to a name using ascii in it, then it just gives me ?????? 's Link to comment https://forums.phpfreaks.com/topic/204973-need-help-with-special-characters/#findComment-1073092 Share on other sites More sharing options...
Cagecrawler Posted June 16, 2010 Share Posted June 16, 2010 You need to make sure that your database collation (at least that's what it's called in MySQL) is set to utf-8. Link to comment https://forums.phpfreaks.com/topic/204973-need-help-with-special-characters/#findComment-1073098 Share on other sites More sharing options...
Jax2 Posted June 16, 2010 Author Share Posted June 16, 2010 You need to make sure that your database collation (at least that's what it's called in MySQL) is set to utf-8. I have checked and it is set to UTF8_general_ci Link to comment https://forums.phpfreaks.com/topic/204973-need-help-with-special-characters/#findComment-1073101 Share on other sites More sharing options...
Jax2 Posted June 16, 2010 Author Share Posted June 16, 2010 If it helps, I also added the following inside my header tags: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> Still no help :/ Link to comment https://forums.phpfreaks.com/topic/204973-need-help-with-special-characters/#findComment-1073106 Share on other sites More sharing options...
Cagecrawler Posted June 16, 2010 Share Posted June 16, 2010 Ok, try using htmlentities(): echo htmlentities($row['player_name'], ENT_COMPAT, 'UTF_8'); Link to comment https://forums.phpfreaks.com/topic/204973-need-help-with-special-characters/#findComment-1073119 Share on other sites More sharing options...
shadiadiph Posted June 16, 2010 Share Posted June 16, 2010 yes but have you saved that page as utf-8 not in wordpad use pspad also have you checked the current setting on the encoding on your browser under page menu > encoding Link to comment https://forums.phpfreaks.com/topic/204973-need-help-with-special-characters/#findComment-1073121 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.