HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Converting Microsoft SQL Server collation to UTF 8

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
utfsqlmicrosoftcollationserverconverting

Problem

I've a Rails-Application, which reads data from a Microsoft SQL Server 2008 R2 Database.

All umlauts are represented by a '?', so I checked the encoding of the database. The encoding is 'Latin 1'. When I try to change it, I have a big list of different collations, but UTF-8 is not listed. The rails application communicates with the database using an ODBC DSN, could this be the source of the problem?

How can I change the database collation to UTF-8?

Solution

Encoding? Do you mean collation? The collation only affects things like equality tests, sort order, etc. They don't affect the allowed encodings for column values.

If you want to store unicode text, you should make sure your columns are among

  • NCHAR



  • NVARCHAR



  • NTEXT (2-byte characters)



rather than

  • CHAR



  • VARCHAR



  • TEXT (1-byte characters).

Context

StackExchange Database Administrators Q#10448, answer score: 3

Revisions (0)

No revisions yet.