# Error when \*just\* adding utf8 encoding to database.yaml

**URL:** <https://www.ruby-forum.com/t/error-when-just-adding-utf8-encoding-to-database-yaml/61536>\
**Category:** Rails\
**Created:** [May 24, 2006, 9:41pm UTC](https://www.ruby-forum.com/t/error-when-just-adding-utf8-encoding-to-database-yaml/61536 "2006-05-24T21:41:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![andy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@andy](https://www.ruby-forum.com/u/andy)\
**Post date:** [May 24, 2006, 9:41pm UTC](https://www.ruby-forum.com/t/error-when-just-adding-utf8-encoding-to-database-yaml/61536/1 "2006-05-24T21:41:43Z")

</div>

Hi,

I have Ruby 1.8.4 and have my MyISAM db and tables created via the  
migration files to utf8. A check with MySQL Front shows that all the  
tables and the db have been correctly created as I wanted them.

I want the site to be in UTF8 format, and added the bit to  
application\_controller.rb to get the correct header. All still worked  
fine at this stage. But I run into trouble when adding:

encoding: utf8

to my otherwise untouched database.yaml.

I had just committed a working version of the site to subversion before  
editing database.yaml and after the database.yaml the the next command I  
ran, ruby script/generate model job\_client\_type, came up with an error:

C:/ruby/lib/ruby/1.8/yaml:133:in ‘load’: syntax error on line 13, 10:  
‘adapter: mysql’ (ArgumentError)  
[Many other errors on initializer.rb, custom\_require.rb etc - I can list  
all if it helps]  
Ends with […]active\_support/dependencies.rb:147: in ‘require’ from  
script/generate: 3

Tried figuring out the problem for hours but can’t.

Only a termination of Webrick, deletion of the site and re-export from  
subversion with the original database.yaml fixes everything again (i.e.  
the model command runs). Merely taking out the offending line from  
database.yaml to effectively reverse the change does _not_ do the trick  
even though it should - fresh export only, which is weird.

Any ideas?

---

<div class="post-metadata">

**Author:** ![andy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@andy](https://www.ruby-forum.com/u/andy)\
**Post date:** [May 24, 2006, 9:43pm UTC](https://www.ruby-forum.com/t/error-when-just-adding-utf8-encoding-to-database-yaml/61536/2 "2006-05-24T21:43:07Z")

</div>

BTW, if it helps, I was following the instructions on  
[http://ruphus.com/blog/2005/06/23/getting-unicode-mysql-and-rails-to-cooperate/](http://ruphus.com/blog/2005/06/23/getting-unicode-mysql-and-rails-to-cooperate/)

---

<div class="post-metadata">

**Author:** ![andy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@andy](https://www.ruby-forum.com/u/andy)\
**Post date:** [May 24, 2006, 9:51pm UTC](https://www.ruby-forum.com/t/error-when-just-adding-utf8-encoding-to-database-yaml/61536/3 "2006-05-24T21:51:52Z")

</div>

Do you have some stray tabs in the file?

~ Ben

---

<div class="post-metadata">

**Author:** ![andy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@andy](https://www.ruby-forum.com/u/andy)\
**Post date:** [May 24, 2006, 10:52pm UTC](https://www.ruby-forum.com/t/error-when-just-adding-utf8-encoding-to-database-yaml/61536/4 "2006-05-24T22:52:07Z")

</div>

Ben R. wrote:

> Do you have some stray tabs in the file?
> 
> ~ Ben

Ben,

Sorry about the delay - was in the middle of a model creation/testing  
and wanted to finish and commit to subversion before attempting to  
recreate the error.

As soon as you mentioned this, I was very positive you had cracked it as  
ArachnoRuby is a bit too tab-happy…

I changed the file in Wordpad, and it seems this was fine. Tabs were the  
culprit… or rather my stupidity for the oversight. A tab instead of  
two spaces kills everything - script/generate, script/server etc.

Would be nice for it not to be so temperamental in a future release, but  
thanks a million Ben.
