Prodigal Son Posted October 12, 2008 Share Posted October 12, 2008 I'm not sure if this is related to the collation, but I have my set at the default one which is latin_swedish I think. If I have any weird symbols or foreign language characters they will come out as other weird symbols. What collation do I need to support all the characters? Or maybe this isn't related to collation? Quote Link to comment https://forums.phpfreaks.com/topic/128130-collation-to-show-all-characters/ Share on other sites More sharing options...
Zane Posted October 13, 2008 Share Posted October 13, 2008 I always set mine to uft8_unicode_ci I try to stay away from a swedish collation..I don't know why that'd be a default Quote Link to comment https://forums.phpfreaks.com/topic/128130-collation-to-show-all-characters/#findComment-663783 Share on other sites More sharing options...
Prodigal Son Posted October 13, 2008 Author Share Posted October 13, 2008 Hmm, I tried changing the collation, but still the same. Maybe its not related then? If I echo out something with another language on my page I will get weird symbols. But if I echo them out into a textarea it shows as the original characters. Any idea why that is? Quote Link to comment https://forums.phpfreaks.com/topic/128130-collation-to-show-all-characters/#findComment-664096 Share on other sites More sharing options...
fenway Posted October 13, 2008 Share Posted October 13, 2008 Are you sure you've configured PHP accordingly? Quote Link to comment https://forums.phpfreaks.com/topic/128130-collation-to-show-all-characters/#findComment-664239 Share on other sites More sharing options...
Prodigal Son Posted October 14, 2008 Author Share Posted October 14, 2008 Are you sure you've configured PHP accordingly? I think so... but not sure what you mean by that lol. This is related to PHP? I figured either it was something related to the database settings, fonts, or something like that. How do I check if my PHP is configured 'accordingly?' Quote Link to comment https://forums.phpfreaks.com/topic/128130-collation-to-show-all-characters/#findComment-664708 Share on other sites More sharing options...
Zane Posted October 14, 2008 Share Posted October 14, 2008 have you configured you phpmyadmin config file right find a file called config.inc.php in the phpmyadmin directory open it and look for a line like this $cfg['DefaultConnectionCollation'] = 'utf8_unicode_ci'; yours might says latin_swedish_ci or something.....just change it there. and you'll also have to change any tables's columns that have this collation....that you have created prior to making this update Quote Link to comment https://forums.phpfreaks.com/topic/128130-collation-to-show-all-characters/#findComment-664719 Share on other sites More sharing options...
Prodigal Son Posted October 14, 2008 Author Share Posted October 14, 2008 have you configured you phpmyadmin config file right find a file called config.inc.php in the phpmyadmin directory open it and look for a line like this $cfg['DefaultConnectionCollation'] = 'utf8_unicode_ci'; yours might says latin_swedish_ci or something.....just change it there. and you'll also have to change any tables's columns that have this collation....that you have created prior to making this update In my config.inc.php file I don't even have that line lol, but I added it, and still the same. I changed the collations all to utf8_unicode_ci already. Quote Link to comment https://forums.phpfreaks.com/topic/128130-collation-to-show-all-characters/#findComment-664723 Share on other sites More sharing options...
Prodigal Son Posted October 16, 2008 Author Share Posted October 16, 2008 Any other ideas? Quote Link to comment https://forums.phpfreaks.com/topic/128130-collation-to-show-all-characters/#findComment-667111 Share on other sites More sharing options...
Prodigal Son Posted October 16, 2008 Author Share Posted October 16, 2008 After googling for a while I put this line under my db connect statement: mysql_query('SET NAMES utf8'); So now when I look at my phpmyadmin I actually see the proper characters instead of weird symbols, but when I echo the columns out I still see weird symbols. So what are some things that would cause it to show weird characters, even though they are proper in the database? Edit: I got it to work. So my db shows the correct characters and when I echo them it shows the correct characters. I had htmlentities on the string from the db, but this takes user input and I don't want to allow html, so if I can't use htmlentities, what else can I use? I don't want to use striptags either. Quote Link to comment https://forums.phpfreaks.com/topic/128130-collation-to-show-all-characters/#findComment-667547 Share on other sites More sharing options...
Prodigal Son Posted October 16, 2008 Author Share Posted October 16, 2008 Hmm, how come sometimes I can't edit my post, but other times I can. Anyways, I didn't even really need to do all this lol. My mistake was using htmlentities instead of just htmlspecialchars! But there is one thing I noticed. In the database right now it shows all the weird characters, but now they show fine on an actual web page. Is this wrong? Should there be no weird characters is the database or the webpage if you were doing it correctly? If I use this line after my db connect: mysql_query('SET NAMES utf8'); It will make it so that no weird characters are entered into the db and when I print the results onto a webpage, it also shows the correct symbols. But then it will show any previous entries with another language/symbols as weird characters, so I would need to go back and change those all. So is it better to do that? Or is it just fine to have weird characters in the DB? I assume the second way is better, but just checking. Quote Link to comment https://forums.phpfreaks.com/topic/128130-collation-to-show-all-characters/#findComment-667583 Share on other sites More sharing options...
fenway Posted October 17, 2008 Share Posted October 17, 2008 If you have old data stored in another collation, then yes, you have to fix that. Quote Link to comment https://forums.phpfreaks.com/topic/128130-collation-to-show-all-characters/#findComment-668116 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.