Skip to content


SQL Server and conversion of local character

I’ve had this problem for the second time yesterday. I’ve had this problem once before, but I could not remember how I solved it then. The situation: Application developed and tested on a local Windows Server 2008, MS SQL Server 2008. I deployed the application on a hosted server with SQL Server 2008 Express. The OS is WS2008 R2. I noticed, that I was missing slovene characters, but just one of them. A letter č (c with caret). I tested the local installation, and everything was fine. I opened SQL Server Management studio, and tried to enter slovene characters there. I typed čšž, submitted the query, and what got insterted was cšž. (notice that č was being converted on the fly to c). What is weird is, that this is happening on a hosted machine, and not on my local machine — although both machines use English as a default language.

Since I’ve had this problem before, and I discussed it with Dejan, I started digging through all of my email correspondence with Dejan, but could not find anything. I checked and changed the collation of a database, still nothing. My best friend, Google, was of no help either. It then struck me. Varchar. It is non-unicode data type. nvarchar is of course, what was needed to fix the problem. It is intriguing though, that all of the other Slovene characters work, but c with caret (č) does not get corrupt as one would expect, but gets converted to c.

A lesson learned, is a lesson earned, I guess. This post is here to remind of this situation next time.

Posted in software.