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-/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.
Colin Law
2010-Mar-29 13:23 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
On 29 March 2010 13:21, Heinz Strunk <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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<%# .. %> is a comment, perhaps you meant <%- Colin> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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. > >-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Gudleik Rasch
2010-Mar-29 13:39 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
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-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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. > >-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Heinz Strunk
2010-Mar-29 14:08 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
No, all I found on google said I have to put it as a comment, <%- gives a syntax error. I just run into the same problem in two other projects. Is there a way to set the encoding application wide? -- 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.
Colin Law
2010-Mar-29 15:05 UTC
Re: Re: incompatible character encodings: ASCII-8BIT and UTF-8
On 29 March 2010 15:08, Heinz Strunk <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> No, all I found on google said I have to put it as a comment, <%- gives > a syntax error.You seem to have snipped the useful stuff. How about encoding rather than coding? Though I am not convinced. Colin> > I just run into the same problem in two other projects. Is there a way > to set the encoding application wide? > -- > 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. > >-- 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.
Heinz Strunk
2010-Mar-29 15:11 UTC
Re: Re: incompatible character encodings: ASCII-8BIT and UTF-8
Sorry, that was a typo. Even though it''s still not working. -- 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.
Heinz Strunk
2010-Mar-29 15:13 UTC
Re: Re: incompatible character encodings: ASCII-8BIT and UTF-8
In every of my 4 projects with this error it always throws it when a special char is being displayed like ä, ö , ü, é, à etc. It would be cool if I just need to paste some "# encoding: utf-8" or something somewhere and it recognizes everything as utf-8, is there anything like that I could do? -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Heinz Strunk
2010-Mar-31 19:58 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
Gudleik Rasch wrote:> 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: utf8Hey, First of all thanks but I tried what you said and well... gem install ruby-mysql config/environment.rb: added config.gem ''ruby-mysql'' config/database.yml: added adapter: mysql, encoding: utf8 But when I start the server I get following error: => Booting WEBrick => Rails 2.3.5 application starting on http://0.0.0.0:3000 D:/ruby19/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement no such file to load -- ruby-mysql ... D:/ruby19/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require''Missing these required gems: ruby-mysql You''re running: ruby 1.9.1.378 at D:/ruby19/bin/ruby.exe rubygems at D:/ruby19/lib/ruby/gems/1.9.1 Run `rake gems:install` to install the missing gems. I of course tried rake gems:install but it didn''t help. I also tried to just uninstall the mysql gem but that didn''t work either. Any idea? -- 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.
Heinz Strunk
2010-Apr-03 20:40 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
Any one knows what''s wrong? -- 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.
Zoran Szagaski
2010-Apr-05 09:45 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
I''m ran into the same problems after switching to Ruby 1.9.1. Have you found a solution yet? -- 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.
Heinz Strunk
2010-Apr-05 10:38 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
Not yet, had to switch back to Ruby 1.8.6. Maybe someone else has an idea? -- 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.
If you have have hard coded strings in ruby code you should try Mystring ="bla bla" Mystring.force_encoding(''ASCII-8BIT'') Before using it. For database strings you should search for mysql to force encoding (this is for db created with ruby 1.8) Good luck Heinz Strunk wrote:> Not yet, had to switch back to Ruby 1.8.6. > > Maybe someone else has an idea? > -- > 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.
Heinz Strunk
2010-Apr-05 13:45 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
That means if I do a "db:migrate:reset" (recreate the db with Ruby 1.9) that error would disappear? -- 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.
Heinz Strunk
2010-Apr-05 14:18 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
I tried it, no it doesn''t :( -- 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.
Heinz Strunk
2010-Apr-05 14:19 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
FYI: I execute these commands: db:drop db:create db:setup Still same error. -- 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.
Andre Lewis
2010-Apr-05 16:09 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
> 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-8Most likely, you are outputting content stored in your DB as UTF-8 onto a template that is ASCII. This fix works for me: http://gist.github.com/273741 -- drop this into config/initializers/ruby_191_hacks.rb. I posted more about upgrading to 1.9.1 here: http://earthcode.com/blog/2010/01/rails_on_ruby_191_in_productio.html -- 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.
Are you sure you don''t have hard coded strings in the partial or strings assigned to variables through controller? Andre Lewis wrote:> > 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 > > Most likely, you are outputting content stored in your DB as UTF-8 onto > a template that is ASCII. This fix works for me: > http://gist.github.com/273741 -- drop this into > config/initializers/ruby_191_hacks.rb. I posted more about upgrading to > 1.9.1 here: > http://earthcode.com/blog/2010/01/rails_on_ruby_191_in_productio.html > -- > 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.
Heinz Strunk
2010-Apr-06 09:49 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
Andre Lewis wrote:> > Most likely, you are outputting content stored in your DB as UTF-8 onto > a template that is ASCII. This fix works for me: > http://gist.github.com/273741 -- drop this into > config/initializers/ruby_191_hacks.rb. I posted more about upgrading to > 1.9.1 here: > http://earthcode.com/blog/2010/01/rails_on_ruby_191_in_productio.htmlUnfortunately not working: => Booting WEBrick => Rails 2.3.5 application starting on http://0.0.0.0:3000 D:/ruby19/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement D:/ruby19/lib/ruby/site_ruby/1.9.1/rubygems/version.rb:186:in `strip!'': can''t modify frozen string (RuntimeError) from D:/ruby19/lib/ruby/site_ruby/1.9.1/rubygems/version.rb:186:in `initialize'' from F:/NetBeansProjects/myproject/config/initializers/ruby_191_hacks.rb:12:in `new'' from F:/NetBeansProjects/myproject/config/initializers/ruby_191_hacks.rb:12:in `<top (required)>'' from D:/ruby19/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in `load'' from D:/ruby19/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in `block in load_with_new_constant_marking'' from D:/ruby19/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'' from D:/ruby19/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in `load_with_new_constant_marking'' from D:/ruby19/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/initializer.rb:622:in `block in load_application_initializers'' from D:/ruby19/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/initializer.rb:621:in `each'' from D:/ruby19/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/initializer.rb:621:in `load_application_initializers'' from D:/ruby19/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/initializer.rb:176:in `process'' from D:/ruby19/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/initializer.rb:113:in `run'' from F:/NetBeansProjects/myproject/config/environment.rb:10:in `<top (required)>'' from D:/ruby19/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'' from D:/ruby19/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `block in require'' from D:/ruby19/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'' from D:/ruby19/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'' from D:/ruby19/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/commands/server.rb:84:in `<top (required)>'' from script/server:3:in `require'' from script/server:3:in `<main>'' -- 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.
Heinz Strunk
2010-Apr-06 09:49 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
Manos wrote:> Are you sure you don''t have hard coded strings in the partial or > strings assigned > to variables through controller?I''m only using I18n.t for strings and globalize2 for model translation. -- 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.
Heinz Strunk
2010-Apr-06 10:07 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
Oh what I forgot. The icompati... error is showing on a line where I''m using I18n.t and it would return a string with a umlaut. -- 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.
I am getting an error incompatible character encodings: ASCII-8BIT and UTF-8 when I try to render a partial view for the children objects of a main object''s edit page. This is the controller method : def update @display_treatment = [ {"exam type"=>"treatmenttype"} , {"preparation comments"=>"preparation"}, {"preparation nature"=>"natureprep"} , {"reference cut"=>"refCoupe"}, {"author"=>"author"}, ] @echantillon = Echantillon.find(params[:id]) @treatments = Treatment.find(:all, :conditions => [''echantillon_id = ?'', @echantillon.id]) respond_to do |format| if @echantillon.update_attributes(params[:echantillon]) flash[:notice] = ''Echantillon was successfully updated.'' format.html { redirect_to(@echantillon) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @echantillon.errors, :status => :unprocessable_entity } end end end and this is in the edit view: <%= render :partial => ''treatmentupdate'', :locals => {:treatments => @echantillon.treatments} %> and this is the partial: <% @i = 1 %> <% for treatment in @treatments %> <tr><td colspan="2"><h2>Traitement <%= @i %> </h2></td></tr> <% fields_for "echantillon[treatment_attributes_updates][]", treatment do |treatment_form|%> <% for c in @display_treatment %> <tr> <td class ="name"> <%= c.first.first %> : </td><td></td><td><%text_field :treatment, c.first.second, :value => treatment[c.first.second] %></td> <td></td> </tr> <% end %> <tr><td colspan="3"><hr/></td></tr> <% end %> <% @i = @i + 1 %> <% end %> I am getting the error on this line: <td class ="name"> <%= c.first.first %> : </td><td></td><td><%text_field :treatment, c.first.second, :value => treatment[c.first.second] %></td> -- 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.
Sven Koesling
2010-Aug-22 21:51 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
Hi, did You find a solution? I have the same problem on all of my projects. DB in UTF8, rails in UTF8, but when it comes to partials with data with german umlauts I get the mentioned error. As far as I understand it''s a problem with the erb rendering engine that forces ASCII encoding. This encoding-thing is so digusting... Greetings Sven -- 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.
Sven Koesling
2010-Aug-22 21:57 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
forgot to say: a workaround that works for me is to add the method ".force_encoding(''utf-8'')" to any variable with date from my database eg.: student.name.force_encoding(''utf-8'') Good Night for now :-) S. -- 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.
Sven Koesling
2010-Aug-22 22:08 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
Gudleik Rasch wrote:> 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: utf8Still not good night ... :-) I tried with rails 3 (rc) and this adapter ruby-mysql and now everything works as expected! Thanks a lot and now finally . Good Night! S. -- 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.
Chris Mear
2010-Aug-23 10:56 UTC
Re: Re: incompatible character encodings: ASCII-8BIT and UTF-8
On 22 August 2010 23:08, Sven Koesling <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Gudleik Rasch wrote: >> 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 > > Still not good night ... :-) > > I tried with rails 3 (rc) and this adapter ruby-mysql and now everything > works as expected!As you figured out, the problem is to do with the old ''mysql'' gem not being encoding-aware for Ruby 1.9. (You''re on Ruby 1.9, right?) As an alternative to ruby-mysql, which is a little slow, you might want to try the ''mysql2'' gem, which is an updated version of the original ''mysql'' gem, and which has native extensions to hook into the MySQL C library, making it faster. Chris -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Sven Koesling
2010-Aug-23 15:52 UTC
Re: Re: incompatible character encodings: ASCII-8BIT and UTF-8
> > As an alternative to ruby-mysql, which is a little slow, you might > want to try the ''mysql2'' gem, which is an updated version of the > original ''mysql'' gem, and which has native extensions to hook into the > MySQL C library, making it faster. > > ChrisHello Chris, thank You very much for this hint! I''ll give it a try in my next night-session.. greetings Sven -- 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.
Sven Koesling
2010-Aug-25 17:34 UTC
Re: Re: incompatible character encodings: ASCII-8BIT and UTF-8
> > thank You very much for this hint! I''ll give it a try in my next > night-session.. > > greetings > SvenOh my god......... first of all, the mysql2 gem works fine - thanks for the hint! But there''s one more thing: I have lots of notices in my rails app like "... wurde gelöscht". But when I have one of those fckng german umlauts in my controller I get this wonderful character encodings error message. I''ll try to solve this with a locale and let You know... greetings Sven -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Sven Koesling
2010-Aug-25 18:01 UTC
Re: Re: incompatible character encodings: ASCII-8BIT and UTF-8
> > I''ll try to solve this with a locale and let You know... > > greetings > Svenhm, within a locale the german umlaute are allowed... -- 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.
Albert C.
2010-Oct-18 21:58 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
Hi, I began reading this post because i have the same problem: Just start the aplicacion with new ruby 1.9.2 raises the error "incompatible character encodings: ASCII-8BIT and UTF-8"..... But I have the problem before reading database, in the main menu when ruby read "opción" and "menú" Does anybody this solution, it seems easy. thanks -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Marnen Laibow-Koser
2010-Oct-19 14:39 UTC
Re: Re: incompatible character encodings: ASCII-8BIT and UTF-8
Sven Koesling wrote in post #935706:> >> >> thank You very much for this hint! I''ll give it a try in my next >> night-session.. >> >> greetings >> Sven > > Oh my god......... > > first of all, the mysql2 gem works fine - thanks for the hint! > > But there''s one more thing: I have lots of notices in my rails app like > "... wurde gelöscht". But when I have one of those fckng german umlauts > in my controller I get this wonderful character encodings error message.First: Display text does not belong in the controller. Keep it in the views (and perhaps the helpers). Second: what is the encoding of the source file containing those characters? Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Sven Koesling
2010-Oct-19 18:51 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
Albert C. wrote in post #955265:> Hi, I began reading this post because i have the same problem: > > Just start the aplicacion with new ruby 1.9.2 raises the error > > "incompatible character encodings: ASCII-8BIT and UTF-8"..... > > But I have the problem before reading database, in the main menu when > ruby read "opción" and "menú" > > Does anybody this solution, it seems easy. > > thanksHi Albert, I don''t understand this. Where are the words "opción" and "menú"? In the view there should be no problem. greetings Sven -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Albert C.
2010-Oct-20 08:35 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
Hi, thanks for responding. It''s very simple, before acces any database, I have a presentation menu, and a text in the view saying than user have to choose an option: <div id="tit_menu"> <p>Seleccione una opción del menú</p> </div> If I change "ó" with "o" and "ú" with "u" works fine. -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Heinz Strunk
2010-Oct-20 12:21 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
It''s not a satisfying solution but whenever I ran into this problem I added # Encoding: utf-8 to the top of the file causing this problem and it worked. Would love to know how to get rid of all these comments and fix it for real though :) -- 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.
Hi, Just for your information - switching to ''mysql2'' gem solved my issue - I was storing Chinese in my DB.. Plus, mysql2 should be the default mysql adapter of Rails 3 anyways... -- 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.
Robert K.
2010-Nov-25 13:36 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
Hallo, I face a similar problem, but here mentioned solutions seem to not work. When I try to display string with non-ascii chars from a mysql database in form, sometimes the program stops with the ''incompatible character encodings: ASCII-8BIT'' error. This issue appears only at some fileds in a table! Configuration of all fields is the same (varchar-string or memo-text, encoding UTF-8). For example: I have record with 4 string fields, all have the same content (the same word). When I try to display them, the ''incompatible...'' error appears. When I check their ''.encoding'', I get UTF-8 for three and ASCII-8BIT for one! Sometimes, when I render this template again and again, two are ASCII and Two UTF. Strange - not? I dont know about any difference among these fields configuration. Yes, .enforce-coding(''utf-8'') added to all instance in erb file works, but it is not natty solution. The same problem appears both at old project transformed from Ruby 1.8/rails 2.2 and at new project creatd in 5minutes via scaffolding in ruby1,9,2/rails3.0.3. The patch ''ruby_191_hacks.rb'' does not work here, I got the same output as ''Posted by Heinz Strunk (cojones) on 2010-04-06 11:49'' I have realized, that the template (erb file) must be saved in the same coding, as the field are (i think the comment about UTF widely mentioned above says to interpeter, that the file is in UTF coding) My configuration: Ruby 1.9.2, Rails 3.0.3 (3.0.1 behaves the same), mysql2 0.2.6 driver (mysql 2.8.1 makes the same problem, mysql-ruby does not work here - it misses an UNIX constant), both mysql2 and utf8 set in database.yml, machine WinXP SP3. Any idea, how to induce ActiveRecord to provide all the fields in the UTF-8 encoding? -- 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.
Gjermund Lunder
2010-Nov-29 12:06 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
all, Thanks for good ideas, but like for Robert K. it''s not working for me (ruby 1.9.2 and rails 3.0.3). Robert K., check that your tables are of type = MyISAM and CHARACTER SET utf8 in Mysql. I get the same error as you; the problem appears almost every time, but suddenly it works for again returning an error. While we are waiting for a solution; how do you use encoding in the erb-files? -> "Yes, .enforce-coding(''utf-8'') added to all instance in erb file works" If you have the detail text in your file and the in witch erb-file do I have to put this encoding I would be very thankful. Thanks again to all. Gjermund developer and DBA -- 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.
Marnen Laibow-Koser
2010-Nov-29 16:43 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
Gjermund Lunder wrote in post #964675:> all, > Thanks for good ideas, but like for Robert K. it''s not working for me > (ruby 1.9.2 and rails 3.0.3). > > Robert K., check that your tables are of type = MyISAM and CHARACTER SET > utf8 in Mysql.Er, why MyISAM? That''s generally a poor idea, since you don''t get transactions or referential integrity. (Of course, using MySQL itself is IMHO a poor idea...) Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org Sent from my iPhone -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Gjermund Lunder
2010-Nov-29 17:58 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
Because unfortunately innoDB tables don’t support full text searching of UTF-8 encoded content. But innoDB tables are more flexible in general. Source of information: http://dev.mysql.com/doc/refman/5.1/en/fulltext-restrictions.html and http://www.dotmana.com/?p=95. This might not be relevant, but could be. Robert K. (or others), If you do have have the exact line for the enforce coding and in witch erb files to put it I would be happy. PS: I''ve tried <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> (http://www.igvita.com/2007/04/11/secure-utf-8-input-in-rails/) in the top of my app/views/layout/application.html.erb I thought this would force the browser to use UFT-8. But not. I''m able to force the browser to show content after the page is read with right click- Encoding on screen (but only i just one of the string columns contains a special characters - strange). -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Marnen Laibow-Koser
2010-Nov-29 18:10 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
Please quote when replying. Gjermund Lunder wrote in post #964821:> Because unfortunately innoDB tables don’t support full text searching of > UTF-8 encoded content.I know that, but I didn''t think full-text searching was at issue here. Perhaps I misread. The fact that you have to choose is a major reason that I no longer use or recommend MySQL. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Conrad Taylor
2010-Nov-29 20:00 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
On Mon, Mar 29, 2010 at 5:21 AM, Heinz Strunk <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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? >Hey, I would recommend using Ruby 1.9.2 instead of Ruby 1.9.1. Next, mysql2 gems is not only faster than the ruby-mysql gem but it provides the following benefits: The Mysql2 gem is meant to serve the extremely common use-case of connecting, querying and iterating on results. Some database libraries out there serve as direct 1:1 mappings of the already complex C API’s available. This one is not. It also forces the use of UTF-8 [or binary] for the connection [and all strings in 1.9, unless Encoding.default_internal is set then it’ll convert from UTF-8 to that encoding] and uses encoding-aware MySQL API calls where it can. For more information, please see the following: https://github.com/brianmario/mysql2 Good luck, -Conrad --> 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Gjermund Lunder
2010-Nov-30 09:44 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
Anyone know how to add this patch?: 0001-enforced-utf-8-encoding-for-ruby-19-and-mysql-text.patch (https://rails.lighthouseapp.com/projects/8994/tickets/4683-ascii-8bit-and-utf-8-in-hell) I''ve never applied such a pacth. Thanks Gjermund -- 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.
Marnen Laibow-Koser
2010-Nov-30 16:32 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
Gjermund Lunder wrote in post #965049:> Anyone know how to add this patch?: > 0001-enforced-utf-8-encoding-for-ruby-19-and-mysql-text.patch >(https://rails.lighthouseapp.com/projects/8994/tickets/4683-ascii-8bit-and-utf-8-in-hell)> > I''ve never applied such a pacth.It''s a standard *nix patch file. The patch command could read it (see its man page for more details), but the a/ and b/ file naming scheme means that you''d probably be better off using git apply.> > Thanks > > GjermundBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- 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.
Robert K.
2010-Nov-30 17:22 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
Marnen Laibow-Koser wrote in post #965150:> It''s a standard *nix patch file. The patch command could read it (see > its man page for more details), but the a/ and b/ file naming scheme > means that you''d probably be better off using git apply.Is possible use a patch command also under Windows? What about Git? Is it safe to install such patch for all the system also for ROR-beginners? Can I modify the source files manually (to exactly know, what have I changed)? -- 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.
Robert K.
2010-Nov-30 17:27 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
Gjermund Lunder wrote in post #964821:> Robert K. (or others), If you do have have the exact line for the > enforce coding and in witch erb files to put it I would be happy.To replicate this error, call: rails -v> Rails 3.0.3ruby - v> ruby 1.9.2p0 (2010-08-18) [i386-mingw32]Mysql version: 5.1.45-community-log rails new r4_test -d mysql && cd r4_test rails g scaffold post title:string content:string rem:text rake db:create rake db:migrate rails s http://localhost:3000/posts call ''New Post'' to all three filends insert e.g. "löwe" or "tomáš" After this I''ll get:> incompatible character encodings: UTF-8 and ASCII-8BITExtracted source (around line #15): 12: 13: <p> 14: <b>Rem:</b> 15: <%= @post.rem %> 16: </p> 17: 18: A monkey work-around -------------------- line 18 in "app\views\posts\index.html.erb" change: <td><%= post.rem.force_encoding(''utf-8'') %></td> A better work-around -------------------- 1)add among the initializers: class ActiveRecord::Base def force_utf attributes.each {|key, value| value.force_encoding(''utf-8'') if value.encoding != ''utf-8'' if value.kind_of?(String) } end end 2)before first loading or using of a activerecord object in the template (here it is a Post) I call .force_utf e.g. insert line 14 in "app\views\posts\index.html.erb" <% post.force_utf %> Changing InnoDb format of a table to Myisam does not help. It is true, this problem does not appear with sqlite; but I have some reasons to use MySQL. I wonder, MySQL should be the couse of the problem - I have used the same database type and revision and structure under 2.2.2 rails / 1.8 ruby without problems I hope, next revision of ROR (3.0.4?) or mysql2 driver will solve this problem. Attachments: http://www.ruby-forum.com/attachment/5493/r4_test.zip -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Gjermund Lunder
2010-Dec-01 09:46 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
Robert K. wrote in post #965170:> > A monkey work-around > -------------------- > A better work-around > --------------------Thanks! Perfect. I''m also waiting for a fix in 3.0.4. As you asked: Does anyone know if patch and Git exists in windows? If no; how to apply std nix patch files? About mysql og not. It''s religion, you know :-) I''ve used Oracle on Unix/Linux through many years. I like mysql, though. -- 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.
Marnen Laibow-Koser
2010-Dec-02 15:21 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
Gjermund Lunder wrote in post #965337:> Robert K. wrote in post #965170: >> >> A monkey work-around >> -------------------- >> A better work-around >> -------------------- > > Thanks! Perfect. > > I''m also waiting for a fix in 3.0.4. As you asked: Does anyone know if > patch and Git exists in windows? If no; how to apply std nix patch > files?Git exists in Windows. A *nix-style patch command probably does too, but why are you torturing yourself with Windows? :)> > About mysql og not. It''s religion, you know :-) I''ve used Oracle on > Unix/Linux through many years. I like mysql, though.SQLite (which Robert mentioned as his alternative) isn''t suitable for production. I no longer trust MySQL, though, and I don''t see why others still do -- it''s got too many silly weaknesses and stupidities. Given the choice, I''ll choose PostgreSQL every time. Not religion, just being tripped up one too many times by MySQL''s issues. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- 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.
Robert K.
2010-Dec-05 20:20 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
Hallo all,>Marnen Laibow-Koser wrote in post #965696: > Git exists in Windows.Yes, but I don''t know to work with it and therefore I cannot imagine, how to update the core of rails without not to break it ):> but why are you torturing yourself with Windows? :)Well, most of my job I make on MS Excel tables with VBA support. Now I am trying to move to Rails, but it does not work yet... Maybe in some months I will be not more dependent on Bill''s products (:> I''ll choose PostgreSQL every time. Not religion, just being tripped up > one too many times by MySQL''s issues.It is not first time I hear someone prefers the postgresql... A good comparison is on http://www.wikivs.com/wiki/MySQL_vs_PostgreSQL. I decided to install a postgresql gem in my Rails to check it, but I failed with: "Installing pg (0.10.0) with native extensions D:/Programs/ruby192/lib/ruby/1.9.1/rubygems/installer.rb:483:in `rescue in block in build_extensions'': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError) D:/Programs/ruby192/bin/ruby.exe extconf.rb checking for pg_config... no checking for libpq-fe.h... *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more" (The same error after I ran either "gem install pg" or "bundle install") This is to much complicated for me to solve. Robert -- 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.
Marnen Laibow-Koser
2010-Dec-06 21:43 UTC
Re: incompatible character encodings: ASCII-8BIT and UTF-8
Robert K. wrote in post #966327:> Hallo all, >>Marnen Laibow-Koser wrote in post #965696: >> Git exists in Windows. > Yes, but I don''t know to work with itLearn.> and therefore I cannot imagine, > how to update the core of rails without not to break it ):I note that you conveniently neglected to quote my point that a *nix-style patch tool also probably exists for Windows. That or Git will apply a patchfile very nicely indeed.> >> but why are you torturing yourself with Windows? :) > Well, most of my job I make on MS Excel tables with VBA support. Now I > am trying to move to Rails, but it does not work yet... Maybe in some > months I will be not more dependent on Bill''s products (:Start now! Use a *nix VM for Rails development. I understand Virtual Rails is nice. [...]> This is to much complicated for me to solve.Well, stop complicating things further by using Windows!> > RobertBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- 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.