UseUnicode always creates ftWideString fields?

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
upscene
Posts: 306
Joined: Thu 19 Oct 2006 08:13

UseUnicode always creates ftWideString fields?

Post by upscene » Tue 19 Jan 2010 12:19

Hi,

In my application, I need to be able to distinguish between ftString and ftWideString.

I'm exporting data to other DBMSses and for unicode string data, this data gets prefixed with N' ', but it seems that always ftWideString is used as the datatype, even though the column in Firebird is defined as VARCHAR with NO Unicode characterset.

Got any ideas how to do this?

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Wed 20 Jan 2010 09:05

InterBase returns all fields in UTF8 when the connection character set is UTF8.

Use the information from the metadata tables like RDB$FIELDS to get fields character set.

upscene
Posts: 306
Joined: Thu 19 Oct 2006 08:13

Post by upscene » Wed 20 Jan 2010 09:14

Plash wrote:InterBase returns all fields in UTF8 when the connection character set is UTF8.

Use the information from the metadata tables like RDB$FIELDS to get fields character set.
The connection characterset is ISO8859_1, I'm using Delphi 2009, so I have no idea why a resultset with VARCHAR is returned as TWideStringField.

In a resultset, the characterset ID is returned in the SQLVAR.

This should be TStringField.

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Thu 21 Jan 2010 09:27

When UseUnicode = True, the connection character set is UNICODE_FSS and a value specified in the Charset option is ignored.

upscene
Posts: 306
Joined: Thu 19 Oct 2006 08:13

Post by upscene » Thu 21 Jan 2010 09:32

Plash wrote:When UseUnicode = True, the connection character set is UNICODE_FSS and a value specified in the Charset option is ignored.
Even for UTF8 databases, btw?

Nevertheless, why ftWideString for an ISO8859_1 VARCHAR field?

upscene
Posts: 306
Joined: Thu 19 Oct 2006 08:13

Post by upscene » Thu 21 Jan 2010 09:33

btw, characterset IGNORED? Why is that?

My application supports Unicode but MUST be able to use any "characterset" when connecting.

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Tue 26 Jan 2010 08:44

This is the sense of the UseUnicode option that Unicode character set is used for the connection. You can connect to a database with any character set when the UNICODE_FSS character set is used for the connection.

Encoding of TStringField depends on Windows regional settings. So there is no sense in using TStringField for any specific InterBase character set. TWideStringField can be used for Unicode and any national character set.

upscene
Posts: 306
Joined: Thu 19 Oct 2006 08:13

Post by upscene » Tue 26 Jan 2010 08:51

Hm, right, let's see where this leads, not being able to distinguish between VARCHAR and true unicode strings is annoying though.

Post Reply