MS SQL Server

MS SQL Server

Inserting unicode characters > 0xFFFF (surrogate pairs) into MS SQL Server with Perl DBD::ODBC

Until recently it has been difficult to insert unicode characters above 0xFFFF into MS SQL Server. DBD::ODBC could do it in such a way that you can select them back correctly but the built in functions (like length, sorting and upper/lower etc) did not treat the surrogate pairs as such so it was limited.

Microsoft SQL Server 2012 introduces a new collation suffix (_SC) and it supports surrogate pairs (although there is an indication that the UTF-16 encoded data must be sent little endian and I've not managed to test on a big endian machine as yet). Here is some test code:

 

More things that don't work with MS Native Client driver

I'm mostly blogging this as a reminder that I've received even more code using Perl and DBD::ODBC via the MS native client driver (not the MS SQL Server ODBC driver which works) which fails in strange ways. This code came to me via Rafael Kitover (@Caelum) and was a cut down demonstration of something dbic does/did? The first example is:
Syndicate content