[fpc-devel] String and UnicodeString and UTF8Stringt

José Mejuto joshyfun at gmail.com
Wed Jan 12 11:46:07 CET 2011


Hello FPC,

Wednesday, January 12, 2011, 11:02:00 AM, you wrote:

>> L> 2. Is it wrong in implementation of TSQLConnectors, which write data
>> L> into record buffer (of TStringField) and do not convert them always into
>> L> UTF-8 ?
>> Do you set the CHARSET field in your TSQLConnector to UTF-8 ?
L> not all connectors supports CharSet property. When I look into sources
L> only MySQL and IB support them (SQLite always return UTF-8 encoded ...
L> ODBC, Postgre and Oracle ignore it)

So partially it is a lack of support in TSQLConnector. Also UTF-8 in
Firebird does not work as expected due a design decision (I think).

L> Yes, this is not primary question of database side,

Oh yes it is! If you miss any of the three steps, it will fail:
1) Database field
2) SQLConnector and Client DLL/so
3) GUI

L> but db client library api, which is used by SQLConnector to
L> retrieve data.

How an UTF8 SQLConnector can retrieve UTF8 data from a field defined
as binary ? Client libraries have all the needed resources to handle
the database, a different thing is that SQLConnector implements them
and/or do it right.

L> For example in ODBC we use SQLGetData in LoadField
L> method to retrieve data from odbc interface. And for example in
L> case of MS SQL Server character data are retrieved in current ANSI
L> code page (in Windows of course, may be that for example in *nix
L> data are retrieved in UTF-8 naturaly) .

Via ODBC ?

L> (AFAIK there is no universal way how to explicitly request
L> character encoding from ODBC interface)

But that's a problem of ODBC, but:

http://web.datadirect.com/resources/odbc/unicode/unix.html

L> So it is true, that every sql connector is mandatory write character
L> data in UTF-8 ?

No. It is mandatory that you send/receive UTF8 to/from GUI LCL
elements. In case you are using a DBF, in example which does not have
encoding information, you can use the transliterate facility of
dataset, but it is a bit awful.

-- 
Best regards,
 José




More information about the fpc-devel mailing list