Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: table collation

  1. #1
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,415
    Thanks
    269
    Thanked 32 Times in 31 Posts

    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.

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,561
    Thanks
    80
    Thanked 4,495 Times in 4,459 Posts
    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.

  • Users who have thanked Old Pedant for this post:

    durangod (02-14-2013)

  • #3
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,415
    Thanks
    269
    Thanked 32 Times in 31 Posts
    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..

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,561
    Thanks
    80
    Thanked 4,495 Times in 4,459 Posts
    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.

  • #5
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,415
    Thanks
    269
    Thanked 32 Times in 31 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •