úterý 4. září 2007

Ruby on Rails, MS SQL Server 2005 and diacritic

It looks like a common problem :) for all developers.
I used Windows 2000 Czech Edition on my developer station, MS SQL Server 2005 Express and Ruby on Rails 1.2.3. There was no problem up to application deployment on server that runs on English edition of Windows Server. Then diacritic was broken and you can see "Jiří Novák" instead of nice "Jiří Novák". Database was OK, application worked fine, so where is problem?

After few experiments, I found solution: add these lines in config/environment.rb

require 'win32ole'
WIN32OLE.codepage = WIN32OLE::CP_UTF8

"Jirí Novák" is better but not perfect. So last modification is just setting of Windows Server - switch default locales to Czech and lalala... "Jiří Novák" is here!

Žádné komentáře: