Mex Noob Yes
2012-Feb-23 22:09 UTC
Issues with template encoding (invalid byte sequence in UTF-8):
Well i have tried to find the answer by myself and i had no luck at all, so here it is: i have followed all the tips i have found here and there, putting <% # coding: UTF-8 %> using encode and force_encoding even trying some wacky regex i came up with (which of course was a dumb idea) i am using ruby 1.9.2p290 and Rails 3.0.3 i have no clue at all what is wrong the crazy part of this is that the line where the error happens is an URL... ActionView::Template::Error (invalid byte sequence in UTF-8): 52: <tr class="<%= cycle("row-odd", "row-even") -%>" title="Direccion de la informacion."> 53: <td> URL </td> 54: <td> 55: <a href="<%= entry[:original_url] %>" target="_blank" title="<%= CGI.unescape( entry[:original_url] ) %>">Abrir en nuevo tab.</a> 56: </td> 57: </tr> 58: app/views/main/results.html.erb:55:in `block (2 levels) in _app_views_main_results_html_erb__4329752108549495342_44926400_4357034463775245520'' app/views/main/results.html.erb:33:in `block in _app_views_main_results_html_erb__4329752108549495342_44926400_4357034463775245520'' app/views/main/results.html.erb:23:in `each'' app/views/main/results.html.erb:23:in `_app_views_main_results_html_erb__4329752108549495342_44926400_4357034463775245520'' in advance thank you very much for your time -- 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
2012-Feb-24 00:47 UTC
Re: Issues with template encoding (invalid byte sequence in UTF-8):
The template is likely UTF-8, but the information from the database, e.g. entry[:original_url] is likely ASCII-8BIT if you are using MySQL and the mysql adapter, assuming your tables are UTF-8. Try using the mysql2 adapter instead. IIRC, install the mysql2 gem and change all ''adapter: mysql'' in config/database.yml to ''adapter: mysql2''. HTH, Jeffrey Quoting Mex Noob Yes <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>:> Well i have tried to find the answer by myself and i had no luck at all, > so here it is: > > i have followed all the tips i have found here and there, putting > <% # coding: UTF-8 %> > using encode and force_encoding > even trying some wacky regex i came up with (which of course was a dumb > idea) > > i am using ruby 1.9.2p290 and Rails 3.0.3 > > i have no clue at all what is wrong > > the crazy part of this is that the line where the error happens > is an URL... > > > ActionView::Template::Error (invalid byte sequence in UTF-8): > 52: <tr class="<%= cycle("row-odd", "row-even") -%>" > title="Direccion de la informacion."> > 53: <td> URL </td> > 54: <td> > 55: <a href="<%= entry[:original_url] %>" > target="_blank" title="<%= CGI.unescape( entry[:original_url] ) > %>">Abrir en nuevo tab.</a> > 56: </td> > 57: </tr> > 58: > app/views/main/results.html.erb:55:in `block (2 levels) in > _app_views_main_results_html_erb__4329752108549495342_44926400_4357034463775245520'' > app/views/main/results.html.erb:33:in `block in > _app_views_main_results_html_erb__4329752108549495342_44926400_4357034463775245520'' > app/views/main/results.html.erb:23:in `each'' > app/views/main/results.html.erb:23:in > `_app_views_main_results_html_erb__4329752108549495342_44926400_4357034463775245520'' > > in advance thank you very much for your time > > -- > 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.
Javier Quarite
2012-Feb-24 00:53 UTC
Re: Issues with template encoding (invalid byte sequence in UTF-8):
Have you tried in the beginning of the file # encoding: UTF-8 It works for me Javier Q. -- 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.
Mex Noob Yes
2012-Feb-24 01:32 UTC
Re: Issues with template encoding (invalid byte sequence in UTF-8):
I figured out what it was (but i have no clue why) it was not the whole content but just title="<%= CGI.unescape( entry[:original_url] )" taking out this fixed the whole problem... kinda makes sense to me, but it is still kinda crazy... hope someone finds this if they get this in their way too and dont spend 4 days trying to fix it with all sorts of encoding, decoding, iconv tricks, trying to set it to "", etc -- 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.