patternsqlMinor
supplementary characters in FreeTDS
Viewed 0 times
charactersfreetdssupplementary
Problem
I have a C++ application that connects to SQL Server 2008 through
However, i am unable to insert supplementary characters to the database through FreeTDS unixODBC.
This is the query that my application is hitting
I can successfully insert the characters in BMP.
This characters are inserted perfectly fine.
While using Microsoft SQL Server Native Client for Linux, the supplementary characters are inserted properly.
unixODBC v2.3.0 has been built with
FreeTDS v0.95 has been built with
FreeTDS unixODBC on an RHEL box.However, i am unable to insert supplementary characters to the database through FreeTDS unixODBC.
[FreeTDS][SQL Server]Error converting characters into server's character set. Some character(s) could not be convertedThis is the query that my application is hitting
INSERT INTO mytable (SAMPLE) VALUES(N'乕乭乺丕')== version details ==
unixODBC version - 2.3.0
freeTDS version - 0.95I can successfully insert the characters in BMP.
This characters are inserted perfectly fine.
INSERT INTO mytable (SAMPLE) VALUES(N'乕乭乺丕')While using Microsoft SQL Server Native Client for Linux, the supplementary characters are inserted properly.
== freetds conf ==
[mysever.mydomain.com]
host = mysever.mydomain.com
port = 1433
tds version = 7.3
debug flags = 0xffff
dump file = /tmp/dump.log
dump file append = no
client charset = UTF-16
use utf-16 = yesunixODBC v2.3.0 has been built with
./configure --prefix=/usr/local/ --enable-iconv --with-iconv-char-enc=UTF8 --with-iconv-ucode-enc=UTF16LEFreeTDS v0.95 has been built with
./configure --prefix=/usr/local --sysconfdir=/usr/local/etc --with-tdsver=7.3Solution
Things to look at / try:
-
Looking at the documentation again (now that you have posted the config file and configuration options), I think your setting of
-
Try rebuilding FreeTDS with
-
Did you see the note about "Version 0.95 removed support for iconv" on the FreeTDS page for How to build: Configure and make? Not sure what, if any, impact this has, but if nothing else helps then you need to verify this part (i.e. that your build of
-
Looking at the
-
Something to consider, perhaps, but if the Microsoft driver does work, why not just switch to using that?
-
Looking at the documentation again (now that you have posted the config file and configuration options), I think your setting of
client charset is incorrect. You specify --with-iconv-char-enc=UTF-8 when configuring the build for the ODBC driver, so I suspect you need to also use UTF-8 when specifying the client charset option (or whatever encoding your app code is using).-
Try rebuilding FreeTDS with
--enable-odbc-wide-tests. This might help narrow down where the issue is (assuming the test uses Supplementary Characters).-
Did you see the note about "Version 0.95 removed support for iconv" on the FreeTDS page for How to build: Configure and make? Not sure what, if any, impact this has, but if nothing else helps then you need to verify this part (i.e. that your build of
iconv works and that it is being used).-
Looking at the
unixODBC website, the main page has a version history and you claim to be using 2.3.0 which, according to that history, was released in April 20th, 2010 (almost 6 years ago). Since then there have been several "wide character"-related bug fixes, as well as many other fixes. Even if some other change (#1 perhaps) fixes the immediate issue, I would still upgrade to the most recent version of this driver, 2.3.4, which was released on August 31st, 2015.-
Something to consider, perhaps, but if the Microsoft driver does work, why not just switch to using that?
Context
StackExchange Database Administrators Q#130655, answer score: 2
Revisions (0)
No revisions yet.