Delphi XE and SQL encoding
Posted: 31.10.2010, 21:12
On some database configuration 7.0 does not work well.
ie. I have Firebird 1.5 database with win1250 encoding internaly. I'm also using polish windows (that means win1250 ansi internal) and I set connection properties to codepage=win1250.
It works fine under delphi 2006, but under XE it destroys native characters in database table on insert/update when using direct SQL.
Reading from database is ok.
Statement: INSERT INTO TABLE VALUES('ąęść')
produces junk in the field. This is due to ZEOS converting the SQL to UTF8 no mater the actual connection encoding.
Statement INSERT INTO TABLE VALUES(:value)
and setting ZQuery.Params[0] := 'ąęść' works ok, and inserts/updates using that method works ok, as all data aware components too.
I think we need some logic to use utf8 encoding when talking with database, not just {$IFDEF DELPHI_12UP}
Looking at sources - this is not only Firebird issue, but I haven't tested this elseware.
Tygrys
ie. I have Firebird 1.5 database with win1250 encoding internaly. I'm also using polish windows (that means win1250 ansi internal) and I set connection properties to codepage=win1250.
It works fine under delphi 2006, but under XE it destroys native characters in database table on insert/update when using direct SQL.
Reading from database is ok.
Statement: INSERT INTO TABLE VALUES('ąęść')
produces junk in the field. This is due to ZEOS converting the SQL to UTF8 no mater the actual connection encoding.
Statement INSERT INTO TABLE VALUES(:value)
and setting ZQuery.Params[0] := 'ąęść' works ok, and inserts/updates using that method works ok, as all data aware components too.
I think we need some logic to use utf8 encoding when talking with database, not just {$IFDEF DELPHI_12UP}
Looking at sources - this is not only Firebird issue, but I haven't tested this elseware.
Tygrys