Re: freebcp UTF8 to UCS-2LE importing
Will McQueen <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <C1174DCAFE2FA74CB0797105D205E7B1010AE99E9A@ars-ex07mail1.corp.athenahealth.com> |
Here's the diff I applied to the 6/1 snapshot to fix the issue I
was having loading UTF8 client data into nvarchar fields in SQL Server.
@@ -1252,8 +1249,8 @@
*/
file_len = collen;
if (bcpcol->char_conv) {
- if (bcpcol->on_server.column_size > bcpcol->column_size)
- collen = (collen * bcpcol->on_server.column_size) / bcpcol->column_size;
+ if (bcpcol->char_conv->server_charset.max_bytes_per_char > bcpcol->char_conv->client_charset.min_bytes_per_char)
+ collen = (collen * bcpcol->char_conv->server_charset.max_bytes_per_char) / bcpcol->char_conv->client_charset.min_bytes_per_char;
cd = bcpcol->char_conv->to_wire;
tdsdump_log(TDS_DBG_FUNC, "Adjusted collen is %d.\n", collen);
Let me know what you think,
Thanks,
Will