I test IBDAC components under Delphi, and I got a problemwhen it comes to communication with firebird database with utf8 encoding.
The problem is: when I make a query, results containing varchars(N) are recognised as long as their size in the databse, and not N-long. They also fail to encode properly.
So, when I have a field varchar(20) with value "FÓ/2015/08/04", in DataSource i get field with size and length 80 (which is byte-size of this field in database), and value becomes "FĂ“/2015/08/04".
After connecting to database IBCConnection.Options.CharLength keeps changing to 1. All in all it looks like components ignore settings I gave them.
What I want to achieve:
I want to get properly encoded stiring after performing my query.
I want field in DataSource to be N-long when retieveing varchar(N).
What I attempted:
All I could find is that I should set for IBCConnection Charset=UTF8 and UseUnicode=True (first thing I did testing), and suggestion to set EnableMemos=True. But it doesn't work.
Data Source=127.0.0.1;Database=C:\Temp\uc.fdb;User ID=****;Password=*****;Client Library=R:\bin\fbclient.dll;Character Set=UTF8;Login Prompt=False
I tried upgrade firebirdserver to 2.5.4 (so i tested newer version of fbclient.dll as well), but I get same results.
versions of software I use:
I test things on Trial version of IBDAC:
version 5.6.19 for RAD studio XE7
I use firebird server 2.5
trouble working with UTF8 firebird database
Re: trouble working with UTF8 firebird database
Unfortunately, we can't reproduce the issue. При включенной опции UseUnicode мы получаем корректное значение VarChar(20) поля равное FÓ/2015/08/04. To investigate this behavior of IBDAC, please send to viktorv*devart*com a small sample to demonstrate the issue, including a script for creation and filling in the test database object.
Re: trouble working with UTF8 firebird database
Well, it turned out that problem was on our database side rather than IBDAC's.
We are rewriting our database to UTF8 encoded version, and we copied domains incorrectly.
We left rdb$fields.RDB$CHARACTER_SET_ID with value "null" assuming that domains should use then default character set of the database, which is not the case.
Nontheless thank you for your support!
We are rewriting our database to UTF8 encoded version, and we copied domains incorrectly.
We left rdb$fields.RDB$CHARACTER_SET_ID with value "null" assuming that domains should use then default character set of the database, which is not the case.
Nontheless thank you for your support!
Re: trouble working with UTF8 firebird database
Hi Jurek,
Setting a default during db creation works for me:
Setting a default during db creation works for me:
Code: Select all
CREATE DATABASE :FileName
USER :UserName PASSWORD :Pwd
PAGE_SIZE 16384
default character set UTF8 collation UNICODE_CI_AI ;
Re: trouble working with UTF8 firebird database
It is good to see that the problem has been solved. Feel free to contact us if you have any further questions about IBDAC.