I''m not sure if this is something in Rails or MySQL, but characters like ? are showing up funky in my app. I see ''?'' in the DB using a query browser, but in the app it shows up as ''A1/4.'' Do I need to use another charset or something? -- Posted via http://www.ruby-forum.com/.
Chris Sepic wrote:> I''m not sure if this is something in Rails or MySQL, but characters like > ? are showing up funky in my app. I see ''?'' in the DB using a query > browser, but in the app it shows up as ''A1/4.'' Do I need to use another > charset or something?try to modify your ApplicationController: __________________________________________ # Filters added to this controller will be run for all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base before_filter :set_charset def set_charset @headers["Content-Type"] = "text/html; charset=iso-8859-1" end end __________________________________________ -- Posted via http://www.ruby-forum.com/.
That almost worked... It is displaying properly, except when I update a list with an ajax call. In the list, it it still showing as ''A1/4.'' However if I display the list normally (using the list action) it looks ok. Strange... last resort wrote:> Chris Sepic wrote: >> I''m not sure if this is something in Rails or MySQL, but characters like >> ? are showing up funky in my app. I see ''?'' in the DB using a query >> browser, but in the app it shows up as ''A1/4.'' Do I need to use another >> charset or something? > > > try to modify your ApplicationController: > __________________________________________ > # Filters added to this controller will be run for all controllers in > the application. > # Likewise, all the methods added will be available for all controllers. > class ApplicationController < ActionController::Base > before_filter :set_charset > > def set_charset > @headers["Content-Type"] = "text/html; charset=iso-8859-1" > end > end > __________________________________________-- Posted via http://www.ruby-forum.com/.
Chris > That almost worked... It is displaying properly, except when I update a > list with an ajax call. In the list, it it still showing as ''A1/4.'' You can set the header manually before rendering the partial : def update_partial_stuff ... @headers["Content-Type"] = "text/html; charset=utf-8" render :partial => ''foo'' end Alain
Still no joy...I think it''s because I''m using RJS templates to update the list. In my .rjs I tried: @headers["Content-Type"] = "text/html; charset=utf-8" page.insert_html :bottom, ''cardList'', :partial => ''card_chunk_add'' Alain Ravet wrote:> Chris > > > That almost worked... It is displaying properly, except when I > update a > > list with an ajax call. In the list, it it still showing as > ''A1/4.'' > > > You can set the header manually before rendering the partial : > > def update_partial_stuff > ... > @headers["Content-Type"] = "text/html; charset=utf-8" > render :partial => ''foo'' > end > > > Alain-- Posted via http://www.ruby-forum.com/.
I think the problem is that RJS changes the content type to text/javascript. If anyone knows how to get around this bug let me know. Chris Sepic wrote:> Still no joy...I think it''s because I''m using RJS templates to update > the list. In my .rjs I tried: > > @headers["Content-Type"] = "text/html; charset=utf-8" > page.insert_html :bottom, ''cardList'', :partial => ''card_chunk_add'' > > Alain Ravet wrote: >> Chris >> >> > That almost worked... It is displaying properly, except when I >> update a >> > list with an ajax call. In the list, it it still showing as >> ''A1/4.'' >> >> >> You can set the header manually before rendering the partial : >> >> def update_partial_stuff >> ... >> @headers["Content-Type"] = "text/html; charset=utf-8" >> render :partial => ''foo'' >> end >> >> >> Alain-- Posted via http://www.ruby-forum.com/.