Display problem

hey guys,

Does anyone know why the french letter “é” is displayed as a question
mark “?” inside an

tag ?

check your character eoncoding header…

On Wednesday, March 22, 2006, at 6:41 PM, weirdmonkey wrote:

http://lists.rubyonrails.org/mailman/listinfo/rails
Mikkel B.

www.strongside.dk - Football Portal(DK)
nflfeed.helenius.org - Football News(DK)
ting.minline.dk - Buy Old Stuff!(DK)

Does anyone know why the french letter “é” is displayed as a question
mark “?” inside an

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

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 S. wrote:

end
end

  • Bernd

Charlie B.
Programmer
Castle Branch Inc.

Try using the h() function. It should change most characters to web
friendly characters.
Ex.
<%= h(“text goes here”) %>

-John


John S.
Computing Staff - Webmaster
Kavli Institute for Theoretical Physics
University of California, Santa Barbara
[email protected]
(805) 893-6307

here is my code for my list.rhtml :

Livres entrés dans MySQL

<% for livre in @livres %>

<%= livre.titre %>: <%= 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é ?" %>
<% end %>

<%= 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

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 ?

Try this…

<%= h("Livres entrés dans MySQL") %>

<% for livre in @livres %>

<%= h(livre.titre) %>: <%= 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é ?") %>
<% end %>

<%= 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:

Livres entrés dans MySQL

<% for livre in @livres %>

<%= h(livre.titre) %>: <%= 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é ?" %>
<% end %>

<%= link_to ‘Nouveau livre’, :action => ‘new’ %>

This will reduce a few unnecessary calls to h().

-John


John S.
Computing Staff - Webmaster
Kavli Institute for Theoretical Physics
University of California, Santa Barbara
[email protected]
(805) 893-6307

John S. wrote:

Try this…

<%= h("Livres entrés dans MySQL") %>

<% for livre in @livres %>

<%= h(livre.titre) %>: <%= link_to 'Afficher', :action =>

-John


John S.
Computing Staff - Webmaster
Kavli Institute for Theoretical Physics
University of California, Santa Barbara
[email protected]
(805) 893-6307

Thank you!
Problem fixed!