Recent

Author Topic: Firebird database with charset NONE  (Read 7783 times)

tonyw

  • Full Member
  • ***
  • Posts: 228
    • MWA Software
Re: Firebird database with charset NONE
« Reply #15 on: June 27, 2021, 09:54:29 am »
When you create a Firebird database, you specify a default character set. This is used as the storage character set unless you explicitly specify a character set for a text column.

When you connect to a database you specify the character set used for the connection. Firebird will attempt to transliterate, if possible, to and from the stored characters into this character set for read/write operations. If transliteration is not possilbe then you get the notorious arihmetic overflow or string conversion error.

Lazarus works internlly in UTF8 for the AnsiString type and a further transliteration is required when the data is received if UTF8 is not used for the connection character set. IBX does this automatically. i cannot speak for other database connectors.

When Character set NONE is speciified as the storage character set, a text string is stored as it was received i.e. using the connection character set. When read back, no transliteration takes place and is interpreted using the connection character set. It works fine as long as the same connection character set is used for read/write.

For Lazarus, I would always use UTF8 in all cases as this avoids the need for transliteration. UTF8 can store all unicode characters and avoids the risk of tranliteration errors. The only downside is that storage space is always four times the characater width. Your choice depends on how much of an issue this is compared to the limitations and issues that arise from use of a single byte "codepage"character set.

Fantablup

  • Full Member
  • ***
  • Posts: 140
Re: Firebird database with charset NONE
« Reply #16 on: June 28, 2021, 05:43:01 am »
Why don't you create the database with UTF8 and collations with UNICODE_CI or UNICODE_CI_AI.
These two is case insentive, so it is easy to do searches.

You will then remove any character problems.

 

TinyPortal © 2005-2018