trouble working with UTF8 firebird database

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Jurek
Posts: 2
Joined: Mon 16 Nov 2015 11:34

trouble working with UTF8 firebird database

Post by Jurek » Mon 16 Nov 2015 12:03

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

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: trouble working with UTF8 firebird database

Post by ViktorV » Wed 18 Nov 2015 10:58

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.

Jurek
Posts: 2
Joined: Mon 16 Nov 2015 11:34

Re: trouble working with UTF8 firebird database

Post by Jurek » Fri 20 Nov 2015 17:02

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!

FredS
Posts: 272
Joined: Mon 10 Nov 2014 17:52

Re: trouble working with UTF8 firebird database

Post by FredS » Fri 20 Nov 2015 20:01

Hi Jurek,

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 ;

ZEuS
Devart Team
Posts: 240
Joined: Thu 05 Apr 2012 07:32

Re: trouble working with UTF8 firebird database

Post by ZEuS » Tue 24 Nov 2015 09:40

It is good to see that the problem has been solved. Feel free to contact us if you have any further questions about IBDAC.

Post Reply