utf 8 - Firebird - UTF8 VarChar size -


I am replacing all the varchar columns in UTF 8 in my firebird database, although I do not understand the difference in the worker size.

For example, there is nothing set with charset and collation, we can set the varchar size to 255, if we set the pigment and ammunition to urf 8, when we use varchar to 255 , Then it reads different values. / P>

What will be the equal worker size for varchar (255) in UTF 8?

"
P> Sufficient space for any N UTF8 characters can be between a length of 1 and 4 of such a character, so only the safe thing lengths of 4 N of each of the characters Allow, which means that to store 50 characters, there should be a space of 200 bytes (worst case scenario).

You can use the tool to look at the interior. Suppose you have a table

  create table "table Agagama" ("Collings" (50 ));  

In a database with the default character set UTF8 (note that you must have atleast the Firebird 2.0 for this.)

The system tables all relations and their fields Stores information about RDB $ RELATION_FIELDS is a record for this field, in which (for example) RDB $ 1 as RDB $ FIELD_SOURCE RDB $ FIELDS has a record for RDB $ 1 , and its value is RDB $ FIELD_LENGT H 200.

To answer your question: For a UTF8 column with a space of 255 characters, you enter it as VARCHAR (255) , but the database It will have a size of 1220 bytes.


Comments