Patrick Aljord
2007-Jan-19 22:43 UTC
simple realtime search not working with utf8 on rails 1.2
hey all, I have this peace of code: # new.rhtml: <% form_tag :action => ''create'' do %> <%= render :partial => ''form'' %> <%= submit_tag "Create" %> <% end %> # _form.rhtml: <p><label for="list_title">Title</label><br/> <%= text_field ''list'', ''title'' %></p> <%= observe_field ''list_title'', :frequency => 0.5, :update => ''results'', :url => { :controller => ''lists'', :action=> ''search'' }, :with => "''list[title]='' + escape(value)" %> <!--[eoform:list]--> <div id="results"> </div> #controller: def search @title = params[''list''][''title''] @titles = List.find(:all,:conditions=>[''title like ?'', "%#{@title}%"]) end it works great, as I type results are displayed in my results div. But if I try to enter letters with accents like éçèà then nothing get displayed. as an exemple if I type ''test éàç'' in the text box I get from development.log: Processing ListsController#search (for 127.0.1.1 at 2007-01-20 00:28:11) [POST] Session ID: 4fa4b22bbeed42322744501e09eb5601 Parameters: {"list"=>{"title"=>"test "}, "action"=>"search", "controller"=>"lists"} List Load (0.001703) SELECT * FROM lists WHERE (title like ''%test %'') any idea how to make it see unicode stuff right? thanx in advance Pat --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Patrick Aljord
2007-Jan-19 23:15 UTC
Re: simple realtime search not working with utf8 on rails 1.2
On 1/19/07, Patrick Aljord <patcito-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> <%= observe_field ''list_title'', :frequency => 0.5, > :update => ''results'', :url => > { :controller => ''lists'', :action=> ''search'' }, > :with => "''list[title]='' + escape(value)" %>ok, it works great if replace escape(value) with value :) is it better to use escape though? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---