hey guys, Does anyone know why the french letter "?" is displayed as a question mark "?" inside an <h1> tag ? -- Posted via http://www.ruby-forum.com/.
check your character eoncoding header... On Wednesday, March 22, 2006, at 6:41 PM, weirdmonkey wrote:>hey guys, > >Does anyone know why the french letter "?" is displayed as a question >mark "?" inside an <h1> tag ? > >-- >Posted via http://www.ruby-forum.com/. >_______________________________________________ >Rails mailing list >Rails@lists.rubyonrails.org >http://lists.rubyonrails.org/mailman/listinfo/railsMikkel Bruun www.strongside.dk - Football Portal(DK) nflfeed.helenius.org - Football News(DK) ting.minline.dk - Buy Old Stuff!(DK) -- Posted with http://DevLists.com. Sign up and save your time!
> Does anyone know why the french letter "?" is displayed as a question > mark "?" inside an <h1> tag ?utf8/latin1 characterset? regards Claus
Add this to app/controllers/application.rb. You may need to replace iso-8859-1 with something else like utf8... class ApplicationController < ActionController::Base ... after_filter :set_charset def set_charset @headers["Content-Type"] ||= "text/html; charset=iso-8859-1" end end - Bernd -- Posted via http://www.ruby-forum.com/.
I have the same type of problems sometimes. Will there be problems for some users if I switch my charecter encoding to utf8? On Wed, 2006-03-22 at 19:10 +0100, Martin Bernd Schmeil wrote:> Add this to app/controllers/application.rb. You may need to replace > iso-8859-1 with something else like utf8... > > class ApplicationController < ActionController::Base > ... > > after_filter :set_charset > > def set_charset > @headers["Content-Type"] ||= "text/html; charset=iso-8859-1" > end > end > > - Bernd >Charlie Bowman Programmer Castle Branch Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060322/51276ec7/attachment.html
Same problem with utf8.... here a pic: http://img214.imageshack.us/img214/1517/rordisplay2qj.jpg Do I need to configure the MySQL fields with the utf8 charset ? -- Posted via http://www.ruby-forum.com/.
Try using the h() function. It should change most characters to web friendly characters. Ex. <%= h("text goes here") %> -John -- John Smilanick Computing Staff - Webmaster Kavli Institute for Theoretical Physics University of California, Santa Barbara jsmilani@kitp.ucsb.edu (805) 893-6307 On Mar 22, 2006, at 2:30 PM, weirdmonkey wrote:> Same problem with utf8.... > > here a pic: http://img214.imageshack.us/img214/1517/rordisplay2qj.jpg > > Do I need to configure the MySQL fields with the utf8 charset ? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060322/6b1c3ae4/attachment.html
here is my code for my list.rhtml : <h1>Livres entr?s dans MySQL</h1> <% for livre in @livres %> <div> <strong><%= livre.titre %></strong>: <%= link_to ''Afficher'', :action => ''show'', :id => livre %>, <%= link_to ''?diter'', :action => ''edit'', :id => livre %>, <%= link_to ''Enlever'', { :action => ''destroy'', :id => livre }, :confirm => "Voulez-vous vraiment enlever ce r?sum? ?" %> </div> <% end %> <br /> <%= link_to ''Nouveau livre'', :action => ''new'' %> everything that comes for the db displays fine, it is just Ruby generated content that displays weird. John, can you edit my code just to see how to implent it (i''m a big beginner) Thank you -- Posted via http://www.ruby-forum.com/.
Try this... =============<h1><%= h("Livres entr?s dans MySQL") %></h1> <% for livre in @livres %> <div> <strong><%= h(livre.titre) %></strong>: <%= link_to ''Afficher'', :action => ''show'', :id => livre %>, <%= link_to h(''?diter''), :action => ''edit'', :id => livre %>, <%= link_to ''Enlever'', { :action => ''destroy'', :id => livre }, :confirm => h("Voulez-vous vraiment enlever ce r?sum? ?") %> </div> <% end %> <br /> <%= link_to ''Nouveau livre'', :action => ''new'' %> ================So if you look at the source of the page you will see "Livres entr?s dans MySQL" has become "Livres entrés dans MySQL". You could even rewrite the above rhtml after you view the source and get the following: =============<h1>Livres entrés dans MySQL</h1> <% for livre in @livres %> <div> <strong><%= h(livre.titre) %></strong>: <%= link_to ''Afficher'', :action => ''show'', :id => livre %>, <%= link_to ''Éditer'', :action => ''edit'', :id => livre %>, <%= link_to ''Enlever'', { :action => ''destroy'', :id => livre }, :confirm => "Voulez-vous vraiment enlever ce résumé ?" %> </div> <% end %> <br /> <%= link_to ''Nouveau livre'', :action => ''new'' %> ================This will reduce a few unnecessary calls to h(). -John -- John Smilanick Computing Staff - Webmaster Kavli Institute for Theoretical Physics University of California, Santa Barbara jsmilani@kitp.ucsb.edu (805) 893-6307 On Mar 22, 2006, at 3:05 PM, weirdmonkey wrote:> here is my code for my list.rhtml : > > <h1>Livres entr?s dans MySQL</h1> > > <% for livre in @livres %> > <div> > <strong><%= livre.titre %></strong>: <%= link_to > ''Afficher'', :action => > ''show'', :id => livre %>, > <%= link_to ''?diter'', :action => ''edit'', :id => livre %>, > <%= link_to ''Enlever'', { :action => ''destroy'', :id => > livre }, :confirm > => "Voulez-vous vraiment enlever ce r?sum? ?" %> > </div> > <% end %> > <br /> > > <%= link_to ''Nouveau livre'', :action => ''new'' %> > > everything that comes for the db displays fine, it is just Ruby > generated content that displays weird. > > John, can you edit my code just to see how to implent it (i''m a big > beginner) > > Thank you > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060323/7a1bda4c/attachment.html
John Smilanick wrote:> Try this... > =============> <h1><%= h("Livres entr?s dans MySQL") %></h1> > > <% for livre in @livres %> > <div> > <strong><%= h(livre.titre) %></strong>: <%= link_to > ''Afficher'', :action =>...> > -John > > -- > John Smilanick > Computing Staff - Webmaster > Kavli Institute for Theoretical Physics > University of California, Santa Barbara > jsmilani@kitp.ucsb.edu > (805) 893-6307Thank you! Problem fixed! -- Posted via http://www.ruby-forum.com/.