New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bound Input Parameter of type SQL_C_WCHAR containing surrogate pairs may be truncated [ODBC160] #155
Comments
Commented by: Jojakim Stahl (jstahl) This patch solves the issue. |
Modified by: Jojakim Stahl (jstahl)Attachment: surrogate.patch [ 12285 ] |
Commented by: Jojakim Stahl (jstahl) a second patch to apply after the first one. |
Modified by: Jojakim Stahl (jstahl)Attachment: surrogate2.patch [ 12291 ] |
Commented by: Jojakim Stahl (jstahl) Summary patch based on current cvs-head |
Modified by: Jojakim Stahl (jstahl)Version: 2.0.2 [ 10465 ] Attachment: bug-160.patch [ 12604 ] |
Commented by: Jojakim Stahl (jstahl) Sorry, the summary patch contained changes for each line due to oel-style problem. |
Modified by: Jojakim Stahl (jstahl)Attachment: bug-160-new.patch [ 12605 ] |
Commented by: @alexpotapchenko Thanks, this patch will be applied for next release after testing. |
Modified by: @alexpotapchenkoAttachment: bug-160.patch [ 12604 ] => |
Modified by: @alexpotapchenkoAttachment: surrogate.patch [ 12285 ] => |
Modified by: @alexpotapchenkoAttachment: surrogate2.patch [ 12291 ] => |
Commented by: @alexpotapchenko Fixed in CVS |
Modified by: @alexpotapchenkostatus: Open [ 1 ] => Resolved [ 5 ] resolution: Fixed [ 1 ] Fix Version: 2.0.5 [ 10771 ] Fix Version: 2.1 Beta [ 10410 ] |
Modified by: @alexpotapchenkostatus: Resolved [ 5 ] => Closed [ 6 ] |
Submitted by: Jojakim Stahl (jstahl)
Attachments:
bug-160-new.patch
Do the following (pseudo-code)
create table test (
strfield varchar(30) character set UTF8
)
SQLDriverConnect( ... CHARSET=UTF8 ...)
SQLPrepareW(hStmt, "insert into test values (?)", SQL_NTS)
SQLBindParameter(hStmt, 1, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_VARCHAR, 30, 0, str_field, sizeof(str_field), &str_field_len);
with str_field containing min 30 chars, and min. one of them beeing a surrogate pairs, means a string conating more than 30 wchar_t entities.
The string can be converted to the UTF8 field without any loss, because FB allows up to 30*4 bytes for the field. However, the driver does assume, that one wchar_t unit results in one char (covering up to 4 bytes in UTF8). The input value will be truncated to 30 wchar_t entities instead of 30 charachters.
Commits: 9fca7df d94a113
The text was updated successfully, but these errors were encountered: