Subject Re: [firebird-support] Why can't CHAR and VARCHAR store binary data (ASCII 0)?
Author Ivan Prenosil
> From: "David Garamond"
> Why can't CHAR and VARCHAR store binary data (ASCII 0)?

Why do you think you can't ?
Have you tried OCTETS character set ? (Or its synonym BINARY, if you prefer)
i.e.
CHAR(10) CHARACTER SET BINARY NOT NULL

Ivan


> Is it because internally the data are represented by null-terminated
> strings? If yes, why? CHAR always has fixed length and VARCHAR has 2
> extra bytes to store string length.
>
> I currently need to store 128-bit MD5 hashes (sort of like UUID/GUID) as
> primary keys. In MySQL, I can use "CHAR(16) BINARY NOT NULL" for this
> data since the CHAR & VARCHAR are "binary safe", but in Firebird I have
> to use "CHAR(18) NOT NULL" (I am encoding to base192, where the charset
> are from ASCII 64 to ASCII 255).