Closed xhit closed 3 years ago
One character is 4 bytes in utf-8, but not in other character encodings. we have to change the divide value depending on the character encoding, but I wonder if I can simply divide by 4?
Isn't it better to return the number of bytes instead of the number of characters, as it is now?
xSQLVAR.sqllen
is only used for VARCHAR
(SQL_TYPE_VARYING
) and CHAR
(SQL_TYPE_TEXT
) but the first is ok because the returned value length is variable.
For CHAR
is fixed, but FirebirdSQL maybe returns the *size of column max len used by charset by character** (in this case, 4 bytes for UTF-8).
So, we need test the size returned in buffer for databases and connection set in another encoding charset, because if logic above is true, the solution only apply to UTF-8.
For CHAR is fixed, but FirebirdSQL maybe returns the *size of column max len used by charset by character** (in this case, 4 bytes for UTF-8).
Tested. The sentence is true.
The length returned in buffer depends on charset set in connection string with charset
param.
For example, with code in #117 and setting charLen := 5
:
?charset=BIG_5
the length is 10 because BIG_5 character length is 2.?charset=ISO8859_13
the length is 5 because ISO8859_13 character length is 1.So, this driver should handle encoding to get the correct length.
@nakagami done. PTAL.
Thanks, It seems good
Fix #117