Skip to Content.
Sympa Menu

freetds - [freetds] FreeTDS + SQL Server 2012 + UTF-16LE

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: John Anderson <sontek AT gmail.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] FreeTDS + SQL Server 2012 + UTF-16LE
  • Date: Fri, 29 Aug 2014 09:50:20 -0700

Hello! I'm wondering if you had any tips on how to work with characters
larger than 0xFFFF? We currently have the problem where we try to
insert/update a row in the database and it gets truncated at the character
and creates an invalid syntax:

For example this character: \U0001f44d

We've tracked this down to the fact that FreeTDS is trying to convert this
to UCS-2 rather than UTF16-LE, which is what SQL Server 2012 uses.

For example if we say:

INSERT INTO table(name) VALUES(N' Hello \U0001f44d')

We get the error:

Unclosed quotation mark after the character string 'Hello ' because it
stops processing the rest of the query.

Is there a freetds.conf or environment setting we can use to tell it to use
UTF-16LE instead of UCS2 so that we can accept these larger character sets?

As a temporary solution we've started sending the raw UTF-16LE bytes to
FreeTDS but we prefer not having to do this.

Thanks,
John




Archive powered by MHonArc 2.6.24.

Top of Page