Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

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).
share|improve this answer
    
Many thanks for you're answer. But I've also data stored in nvarchar-columns, and they'll also aren't represented correctly. May my Rails-app is the source of the problem. –  Beastcraft Jan 11 '12 at 8:27
    
That's interesting. I'm not familiar enough with Rails to know how the string handling and ODBC APIs work, but the two-byte characters are probably throwing it off somehow. –  db2 Jan 11 '12 at 13:05
    
Note: text and ntext are deprecated -- instead, use varchar(MAX) and nvarchar(MAX) respectively. –  Jon Seigel Sep 14 '12 at 16:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.