rubyonrailsin

A Ruby and Rails talk

Monday, March 29, 2010


Re: [Rails] incompatible character encodings: ASCII-8BIT and UTF-8

by rubyonrailsin 0 comments

Tag


Share this post:
Design Float
StumbleUpon
Reddit

I've been struggling with the same issue a few times, and the solution
that worked for me was to use a different mysql driver: ruby-mysql

# in config/environment.rb:
config.gem 'ruby-mysql'

# or in Gemfile:
gem 'ruby-mysql'

The encoding must also be set in config/database.yml:
adapter: mysql
encoding: utf8

On Mon, Mar 29, 2010 at 2:21 PM, Heinz Strunk <lists@ruby-forum.com> wrote:
> Hello,
>
> I just tried to migrate one of my applications from ruby 1.8 to ruby 1.9
> and get following error:
>  Showing app/views/layouts/application.html.erb where line #48  raised:
>  incompatible character encodings: ASCII-8BIT and UTF-8
>
>  48:     <%= render :partial => 'layouts/menu' %>
>
> I added "<%# coding: utf-8 %>" in application.html.erb and
> layouts/_menu.rhtml but it still throws that error, anyone knows why?
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment

Subscribe feeds via e-mail

Blog Archive