Page 1 of 1
UseUnicode always creates ftWideString fields?
Posted: Tue 19 Jan 2010 12:19
by upscene
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?
Posted: Wed 20 Jan 2010 09:05
by Plash
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.
Posted: Wed 20 Jan 2010 09:14
by upscene
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.
Posted: Thu 21 Jan 2010 09:27
by Plash
When UseUnicode = True, the connection character set is UNICODE_FSS and a value specified in the Charset option is ignored.
Posted: Thu 21 Jan 2010 09:32
by upscene
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?
Posted: Thu 21 Jan 2010 09:33
by upscene
btw, characterset IGNORED? Why is that?
My application supports Unicode but MUST be able to use any "characterset" when connecting.
Posted: Tue 26 Jan 2010 08:44
by Plash
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.
Posted: Tue 26 Jan 2010 08:51
by upscene
Hm, right, let's see where this leads, not being able to distinguish between VARCHAR and true unicode strings is annoying though.