Rails cant display £

Hi, under webrick the character, £, displays fine. Under apache it has
some problems.

The £ displays fine on my administrator page, using the default
generated code:

<% for column in Product.content_columns %>

<%= column.human_name %>: <%=h @product.send(column.name) %>

<% end %>

but when i construct my own view, and use:

<%= @product.price_prefix %><%= sprintf("%0.2f",@product.price) %>

the £ displays as ablack diamond and white question mark.

Whats that all about?

the £ displays as ablack diamond and white question mark.

Whats that all about?

The pound sign should be the character entity: £

Various page encodings will probably mess with it in different ways
otherwise.

Regards,
Andrew

Thanks andrew, unfortunatly this is user entered content, i feel its not
reasonable to ask them to enter &pound.

But i dont understand how it can be displayed correctly, and incorrectly
on the same site, rails is doing something different when it renders
these views.

Thanks Jorge, unfortunately it had no effect.

Try put an ‘H’ when you output ruby code, eg:

<%=h @product.price_prefix %> <%=h sprintf("%0.2f",@product.price)%>

<%=h CONTENT %>

will escape things for you.

Jorge

On 3/1/07, Jon [email protected] wrote:

Posted via http://www.ruby-forum.com/.

Jorge S.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs