I'm wondering what binary character set is and what is a difference from, let's say, ISO/IEC 8859-1 aka Latin-1 character set?
-
1There is nice article about character encoding: http://en.wikipedia.org/wiki/Character_encoding – Paya Jun 08 '10 at 11:25
-
I found that term (binary character set) in Sybase documentation but it’s also used in MySQL terminology. – Marvin Divo Jun 09 '10 at 07:16
1 Answers
There's a page in the MySQL documentation about The _bin and binary Collations.
Nonbinary strings (as stored in the CHAR, VARCHAR, and TEXT data types) have a character set and collation. A given character set can have several collations, each of which defines a particular sorting and comparison order for the characters in the set. One of these is the binary collation for the character set, indicated by a _bin suffix in the collation name. For example, latin1 and utf8 have binary collations named latin1_bin and utf8_bin.
Binary strings (as stored in the BINARY, VARBINARY, and BLOB data types) have no character set or collation in the sense that nonbinary strings do. (Applied to a binary string, the CHARSET() and COLLATION() functions both return a value of binary.) Binary strings are sequences of bytes and the numeric values of those bytes determine sort order.
And so on. Maybe gives more sense? If not, I'd recommend looking further in the documentation for descriptions about these things. If it's a concept, it should be explained. Usually is :)
-
What is the difference between binary strings (as stored in `binary`, `varbinary`, `blob`) vs chracter strings (`char`, `varchar`, `text`) that have their charset explicitly set to binary? – Pacerier Jul 11 '12 at 16:13
-
Binary is, well, for binary stuff. I'd use those for things like image data, binary hashes or whatever. Not strings and characters. – Svish Jul 12 '12 at 16:03
-
1I've checked earlier on. There's no difference between `binary` and `char charset binary`. MySQL interprets `char` with charset set to binary as synonym for `binary`. – Pacerier Jul 12 '12 at 17:02