doubledee — 2011-08-20T17:11:53-04:00 — #1
Should I define my Character Set in my MySQL connect script (as opposed to not defining it at all)?
// Define Character Set.
mittineague — 2011-08-20T18:52:24-04:00 — #2
If you don't set it, it will set to the default.
IMHO it's best to pick one and use it everywhere consistantly - database, text editors, files etc. - everywhere.
doubledee — 2011-08-20T20:32:31-04:00 — #3
Isn't UTF-8 the default anyways?
How do I define it across the board?
I guess for the database portion I set it as described.
What about in my PHP files?
guelphdad — 2011-08-20T21:52:50-04:00 — #4
Latin 1 is default I believe. If you want to set one by default you'd do that in your my.ini file and restart the mysql server.
doubledee — 2011-08-20T22:01:20-04:00 — #5
What is the difference between UTF-8 and Latin-1?
Which Character Set would I want anyways?
guelphdad — 2011-08-21T00:01:14-04:00 — #6
Did you read the manual under Character sets and Collation?
doubledee — 2011-08-21T00:18:21-04:00 — #7
I don't eve know what Collation is?! :-/
And, no, I didn't check the manual. Not sure where to even start looking, so I asked here.
guelphdad — 2011-08-21T00:54:59-04:00 — #8
Now you know where to look in the manual.
mittineague — 2011-08-21T03:23:02-04:00 — #9
The following is a gross understatement, so don't hesitate to read the MySQL documentation which, IMHO, is pretty good compared to some.
If you are planning on only ever storing the "128 American keyboard" characters, you probably don't need to worry about it much, though of course the more you know the better
But as soon as you go outside of these, from "fancy quotes" to umlauts and tildes to Chinese glyphs, etc. then the character set becomes more important.
I think UTF-8 is a wise choice and covers most languages and characters you're likely to ever use.
Collation is important if you plan on having text searches of the database. I don't have a real example, but as I understand it, say that in most langauges
"a" is "less than" "e", there may be a language where the character "e" comes first, so the query would fail. Again, if you know you won't ever be working with anything other than American English, it's probably not worth fretting about.
doubledee — 2011-08-21T13:07:32-04:00 — #10
All things in phases...
(If I could get 20 visitors to my website every day I'd me elated?! :rolleyes: Worrying about an international crowd, complex collations, etc is way down the road!)
oddz — 2011-08-22T13:10:53-04:00 — #11
Anticipating things up front saves time, money and not to mention headaches. A few months from now you might even remember why or what you wrote. So prime time to add things is in the beginning, when your fully focused/knowledgeable in all decisions that have been made. Adding things later generally can not be avoided but anticipation of as many things up-front as possible will alleviate bugs and what not down the road. Especially if your working on your own personal project where cost is not a factor.
doubledee — 2011-08-22T13:16:49-04:00 — #12
So what do you use for your MySQL instances and why?