Hi all According to the Agile 2nd Ed book I added the line encoding: utf8 to my database.yml connections. But now when running rake I get plenty of errors: Character set ''utf-8'' is not a compiled character set and is not specified in the ''/usr/local/mysql/share/mysql/charsets/Index'' file What''s wrong here? I checked this Index file, but it seems to be empty... Thanks a lot Josh -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi, you should be able to add the encoding as follows to the database.yml file: encoding: UTF8 Let me know if this works for you. -Conrad On 4/1/07, Joshua Muheim <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hi all > > According to the Agile 2nd Ed book I added the line encoding: utf8 to my > database.yml connections. > > But now when running rake I get plenty of errors: > > Character set ''utf-8'' is not a compiled character set and is not > specified in the ''/usr/local/mysql/share/mysql/charsets/Index'' file > > What''s wrong here? > I checked this Index file, but it seems to be empty... > > Thanks a lot > Josh > > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi, it''s allways helpful to supply any relevant files when asking a question about an error that one is receiving. -Conrad On 4/1/07, Conrad Taylor <conradwt-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, you should be able to add the encoding as follows to the database.yml file: > > encoding: UTF8 > > Let me know if this works for you. > > -Conrad > > On 4/1/07, Joshua Muheim <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > > > > Hi all > > > > According to the Agile 2nd Ed book I added the line encoding: utf8 to my > > database.yml connections. > > > > But now when running rake I get plenty of errors: > > > > Character set ''utf-8'' is not a compiled character set and is not > > specified in the ''/usr/local/mysql/share/mysql/charsets/Index'' file > > > > What''s wrong here? > > I checked this Index file, but it seems to be empty... > > > > Thanks a lot > > Josh > > > > -- > > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
there are several places that can cause problems with utf-8 encoding.
but some tricks are to:
1. make sure that every file in your project is utf-8 based (if you
are using rad rails, this is simple to accomplish: mark your project,
select properties, in the "text-file-encoding" box, select
"other:
utf-8")
Be sure to put in your strange "å,ä,ö" characters in your files again
or you''ll get a mysql error, because it will change your
"å,ä,ö" to a
"square" (unknown character)
2. in your databases.yml set for each server environment (in this
example "development" with mysql)
development:
adapter: mysql
encoding: utf8
3. set a before filter in your application controller
(application.rb):
class ApplicationController < ActionController::Base
before_filter :set_charset
def set_charset
@headers["Content-Type"] = "text/html; charset=utf-8"
end
end
4. be sure to set the encoding to utf-8 in your mysql (I''ve only used
mysql.. so I don''t know about other databases) for every table. If you
use mySQL Administrator you can do like this: edit table, press the
"table option" tab, change charset to "utf8" and collation
to
"utf8_general_ci"
uhmm.. that''s all I can think of right now.
On 2 Apr, 01:12, "Conrad Taylor"
<conra...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi, it''s allways helpful to supply any relevant files when asking
a
> question about an error that one is receiving.
>
> -Conrad
>
> On 4/1/07, Conrad Taylor
<conra...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>
>
> > Hi, you should be able to add the encoding as follows to the
database.yml file:
>
> > encoding: UTF8
>
> > Let me know if this works for you.
>
> > -Conrad
>
> > On 4/1/07, Joshua Muheim
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:
>
> > > Hi all
>
> > > According to the Agile 2nd Ed book I added the line encoding:
utf8 to my
> > > database.yml connections.
>
> > > But now when running rake I get plenty of errors:
>
> > > Character set ''utf-8'' is not a compiled
character set and is not
> > > specified in the
''/usr/local/mysql/share/mysql/charsets/Index'' file
>
> > > What''s wrong here?
> > > I checked this Index file, but it seems to be empty...
>
> > > Thanks a lot
> > > Josh
>
> > > --
> > > Posted viahttp://www.ruby-forum.com/.- Dölj citerad text -
>
> - Visa citerad text -
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
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
-~----------~----~----~----~------~----~------~--~---
Well, I tested this code from http://dev.rubyonrails.org/ticket/2404 and
it works for me:
class Fixture
attr_reader :class_name
end
class Fixtures
@@inserted_fixture_list ||= {}
alias :original_insert_fixtures :insert_fixtures
def insert_fixtures
return if @@inserted_fixture_list[values[0].class_name]
@@inserted_fixture_list[values[0].class_name] = true
unless ActiveRecord::Base.connection.select_one("select 1 from
#{fixture_class_to_table_name(values[0].class_name)}")
original_insert_fixtures
end
end
def delete_existing_fixtures() end
# compute a fixture''s table name from its (known) class name
def fixture_class_to_table_name(class_name)
Inflector::tableize(class_name)
end
end
But I hate it to change Rails'' default behavior with code I
don''t really
understand and might disturb Rails in a later release... :-/
--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Oh I''m very sorry, this reply was meant for another thread... http://www.ruby-forum.com/topic/103919 -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Joshua Muheim wrote:> Hi all > > According to the Agile 2nd Ed book I added the line encoding: utf8 to my > database.yml connections. > > But now when running rake I get plenty of errors: > > Character set ''utf-8'' is not a compiled character set and is not > specified in the ''/usr/local/mysql/share/mysql/charsets/Index'' file > > What''s wrong here? > I checked this Index file, but it seems to be empty... > > Thanks a lot > JoshYou have to make sure your database is created to utf8 as the default character set. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Jeffrey L. Taylor
2010-May-03 20:01 UTC
Re: Re: database.yml: encoding: utf8 does not work
Quoting Edmond Chui <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>:> Joshua Muheim wrote: > > Hi all > > > > According to the Agile 2nd Ed book I added the line encoding: utf8 to my > > database.yml connections. > > > > But now when running rake I get plenty of errors: > > > > Character set ''utf-8'' is not a compiled character set and is not > > specified in the ''/usr/local/mysql/share/mysql/charsets/Index'' file > > > > What''s wrong here? > > I checked this Index file, but it seems to be empty... > > > > Thanks a lot > > Josh > > You have to make sure your database is created to utf8 as the default > character set.And that the encoding is called utf-8. In my config/database.yml I have: encoding: utf8 Also check the default and/or table(s) character set and collation in MySQL. Jeffrey -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.