# Problems with MS SQL Server and ruby on rails

**URL:** <https://www.ruby-forum.com/t/problems-with-ms-sql-server-and-ruby-on-rails/127373>\
**Category:** Rails\
**Created:** [January 28, 2008, 6:34pm UTC](https://www.ruby-forum.com/t/problems-with-ms-sql-server-and-ruby-on-rails/127373 "2008-01-28T18:34:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![arnoldorl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/bc79bd/32.png) [@arnoldorl](https://www.ruby-forum.com/u/arnoldorl)\
**Post date:** [January 28, 2008, 6:34pm UTC](https://www.ruby-forum.com/t/problems-with-ms-sql-server-and-ruby-on-rails/127373/1 "2008-01-28T18:34:06Z")

</div>

I have a problem when I save data in the database. The problem is  
because I send some characters with accent or any other latin character  
like Ã±, I have changed some configuration like the encoding in the  
application controller I have changed it to ISO-8859-1 adding at the top  
of the file the next:

before\_filter :set\_charset

```
 def set_charset
   @headers['Content-Type'] = 'text/html; charset=ISO-8859-1'

 end

```

, also I have add “encoding :ISO-8859-1” to the file database.yml in the  
database conecction parameters, and I have changed the stream to in  
the file app/views/layout/idiomas.rhtml. But It works just in some cases  
for example I don’t have any problem when I try to save or update the  
word “espaÃ±ool” or the word “estÃ¡nn” but if I try to save or update the  
word “espaÃ±ol” or the word “estÃ¡” the application shows an error like  
this:

DBI::DatabaseError: Execute  
OLE error code:80040E14 in Microsoft OLE DB Provider for SQL Server  
Unclosed quotation mark before the character string ’ WHERE [id] =  
29’.  
HRESULT error code:0x80020009  
OcurriÃ³ una excepciÃ³n.: UPDATE idiomas SET [idioma] = ‘estÃ¡’ WHERE  
[id] = 29

What I want is that if I save whit the aplications words with latin  
characters they apear in the databes like I worte them, for example if i  
write the word “espaÃ±ol” or “estÃ¡” they appear in the database like  
“espaÃ±ol” or “estÃ¡”. I don’t want that the application change the  
characters and pust something like “estÃƒÂ¡” instead of “estÃ¡”.

I don’t know what to do, if someone knows how to solve this problem tell  
me please.
