Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-14-2013, 09:02 AM   PM User | #1
durangod
Senior Coder

 
Join Date: Nov 2010
Posts: 1,177
Thanks: 214
Thanked 31 Times in 30 Posts
durangod is on a distinguished road
table collation

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?

Thanks.

Last edited by durangod; 02-15-2013 at 07:00 AM..
durangod is offline   Reply With Quote
Old 02-14-2013, 07:58 PM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,162
Thanks: 59
Thanked 3,992 Times in 3,961 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
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.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Users who have thanked Old Pedant for this post:
durangod (02-14-2013)
Old 02-14-2013, 09:05 PM   PM User | #3
durangod
Senior Coder

 
Join Date: Nov 2010
Posts: 1,177
Thanks: 214
Thanked 31 Times in 30 Posts
durangod is on a distinguished road
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..
durangod is offline   Reply With Quote
Old 02-14-2013, 11:06 PM   PM User | #4
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,162
Thanks: 59
Thanked 3,992 Times in 3,961 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
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.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Old 02-14-2013, 11:27 PM   PM User | #5
durangod
Senior Coder

 
Join Date: Nov 2010
Posts: 1,177
Thanks: 214
Thanked 31 Times in 30 Posts
durangod is on a distinguished road
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
durangod is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:50 AM.


Advertisement
Log in to turn off these ads.