And
3. Because an UTF8char can be 4 times the size of a (Ansi)Char, the field must also be 4 times the size you may expect because of that.
In Firebird, if the field is declared with codepage utf8 (and it is automatically, if the default character set for the database was set to utf8 before the table creation), the actual size is adjusted behind the scene (to be 4 times declared size, actually), it is not something you need to worry about.
To be sure of that, execute this (replace the table name in the last line):
SELECT rf.rdb$relation_name, rf.rdb$field_name, cs.rdb$character_set_name,
f.rdb$character_length, f.rdb$field_length, cs.rdb$bytes_per_character
FROM rdb$fields f
INNER JOIN rdb$relation_fields rf ON rf.rdb$field_source = f.rdb$field_name
INNER JOIN rdb$character_sets cs ON cs.rdb$character_set_id = f.rdb$character_set_id
WHERE rf.rdb$relation_name = 'TABLE1' /* replace with your table name */
You will get a list of the varchar and char fields from the table you want.
Now, examine the results:
- is rdb$character_set_name for all fields "UTF8"?
- compare the values of rdb$character_length and rdb$field_length.