Jump to content

Collation to show all characters?


Prodigal Son

Recommended Posts

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.