Wrong field types with UseUnicode and non-UTF8 fields
Posted: Sun 03 Jan 2010 06:17
Driver 2.50.20
FB 2.1
If I create a database with no default character set, and as such:
CREATE TABLE TEST1 (
DESCRIPTION1 VARCHAR(10) CHARACTER SET UTF8,
DESCRIPTION2 VARCHAR(10),
DESCRIPTION3 CHAR
);
Then for the driver I set UseUnocode=True, ALL THREE fields are created as TWideStringField (with the correct sizes: 10, 10, 1) however as the second and third fields are not using a character set that can store other than ASCII, they should be created as TStringField.
After the 3 TWideStringField fields are created, then say in DESCRIPTION2 I store some non-ascii characters, they are stored and retrieved by dbxida as entered but the data in the database is not correct (view it using isql or anything that knows that the field is not UTF8).
In this case, surely the second and third fields should be created as TStringField and any non-ascii characters should be lost/converted in the normal manner when converting to an ansii string.
FB 2.1
If I create a database with no default character set, and as such:
CREATE TABLE TEST1 (
DESCRIPTION1 VARCHAR(10) CHARACTER SET UTF8,
DESCRIPTION2 VARCHAR(10),
DESCRIPTION3 CHAR
);
Then for the driver I set UseUnocode=True, ALL THREE fields are created as TWideStringField (with the correct sizes: 10, 10, 1) however as the second and third fields are not using a character set that can store other than ASCII, they should be created as TStringField.
After the 3 TWideStringField fields are created, then say in DESCRIPTION2 I store some non-ascii characters, they are stored and retrieved by dbxida as entered but the data in the database is not correct (view it using isql or anything that knows that the field is not UTF8).
In this case, surely the second and third fields should be created as TStringField and any non-ascii characters should be lost/converted in the normal manner when converting to an ansii string.