View Full Version : Resolved table collation

02-14-2013, 10:02 AM
Hi i have been doing some reading and trying to decide on the better collation for my tables.

I have limited it to 'latin 1 swedish ci' or 'utf8 unicode ci'

But i dont know enough about them comparison wise to really make a good choice.

Im guessing it all depends on where your table will be used as far as what language is going to be attempted with it.

I dont plan on my script being anyone outside of english speaking countries but i also dont want to limit myself.

I have always used latin 1 swedish ci in all my tables in the past, but i have heard that alot of people are switching to utf8.

Any suggestions on what i should base my decision on, the right way?


Old Pedant
02-14-2013, 08:58 PM
Besides being useful for many non-European languages (and even for some of them!), UTF8 can also handle all of the characters that are used in word processing, such as "curly quotes" and m-dash and copyright symbol an more.

To the Latin1 may be okay for form fields such as names, address, etc., but if you have any fields where you allow people to copy/paste text from other sources--especially from word processors--you might want to at least make those fields UTF8.

02-14-2013, 10:05 PM
Since i cannot really control who does copy and paste to my text fields i think that def pushes the decision as you said to utf8. So i will do them all as utf8 just to keep uniformity.

The fields in this case will be ip, siteurl (no http:// leader), and config values, all three set as var char no default and not null..

Old Pedant
02-15-2013, 12:06 AM
Well clearly, if you *validate* the IP address, it doesn't need to be UTF8.

Probably the config values don't need to be, either.

Again, validating inputs to be sure they are legal values is really important, and in this case will save you a little room in the DB if you do so.

02-15-2013, 12:27 AM
Yeah thanks, thats another reason i split up the input values for ip into 4 inputs because i wanted to set them as intval() to make it secure and then mask the . in when i concatenate it before i store it as one value.

I would like to make the config values all int as well, even table value as int but there may be additions to the config values later and some may be var char.

Right now the only config value in there is the records per page that can be set dynamically in admin panel and that is def an int value.

Yes i validate data two ways. First thru javascript and then as a backup thru php.

thanks :)