[fpc-devel] String and UnicodeString and UTF8Stringt

José Mejuto joshyfun at gmail.com
Wed Jan 12 16:19:31 CET 2011


Hello FPC,

Wednesday, January 12, 2011, 2:59:53 PM, you wrote:

>> 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 ?
L> It cann't .
L> Here I am speaking about TStringField, which is IMHO designed for 
L> character data, for binary data is designed TBinaryField

And a binary field is an string without encoding, collate and other
text explicit attributes.

>> But that's a problem of ODBC, but:
>> http://web.datadirect.com/resources/odbc/unicode/unix.html
L> Yes in UNIX world it may be so (I do not know),
L> but in Windows ODBC we have no such possibility AFAIK

Quote from Microsoft:
"The ODBC 3.5 (or higher) Driver Manager supports both ANSI and
Unicode versions of all functions that accept pointers to character
strings or SQLPOINTER in their arguments. The Unicode functions are
implemented as functions (with a suffix of W), not as macros. The ANSI
functions (which can be called with or without a suffix of A) are
identical to the current ODBC API functions."

ODBC 3.5 was launched around 2000-2001.

L> So it can be UTF-8, UTF-16 or UTF-32 ... in all cases we must allocate
L> space 4*[max.number of characters in field], right ?
L> So in what encoding are string data stored now in TStringField ?

In the same format the database bring them to it. Database returns a
bunch of bytes and a description of that bytes.

-- 
Best regards,
 José




More information about the fpc-devel mailing list