Displaying currency symbols in select

I can't seem to get a £ symbol to display correctly in a form select
element.

I have tried:
number_to_currency(u.price, :unit => "&pound")
number_to_currency(u.price, :unit => "£")
h ( number_to_currency(u.price, :unit => "&pound") )
h ( number_to_currency(u.price, :unit => "£") )

They all display a ? or "£"

Is there a way around this?

···

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

James Sturrock wrote:

I can't seem to get a £ symbol to display correctly in a form select
element.

I have tried:
number_to_currency(u.price, :unit => "&pound")
number_to_currency(u.price, :unit => "£")
h ( number_to_currency(u.price, :unit => "&pound") )
h ( number_to_currency(u.price, :unit => "£") )

They all display a ? or "£"

Is there a way around this?

Well, you should close it with a ;, "£", not "&pound".

Regards
Stefan

···

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

Stefan Rusterholz wrote:

Well, you should close it with a ;, "£", not "&pound".

Regards
Stefan

I have tried it with the ';' and its still doesn't work. Has anybody
else managed to display a £ sign in a form select?

···

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

James Sturrock wrote:

Stefan Rusterholz wrote:

Well, you should close it with a ;, "£", not "&pound".

Regards
Stefan

I have tried it with the ';' and its still doesn't work. Has anybody
else managed to display a £ sign in a form select?

I don't have any problem with neither £ nor with charset set to
utf-8 and a literal £ in utf-8.
Maybe you should take a look at what rails emits? (I don't use rails, so
forgive my ignorance, but maybe rails escapes the £ to
&ound;?)

Regards
Stefan

···

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

Stefan Rusterholz wrote:

I don't have any problem with neither £ nor with charset set to
utf-8 and a literal £ in utf-8.
Maybe you should take a look at what rails emits? (I don't use rails, so
forgive my ignorance, but maybe rails escapes the £ to
&ound;?)

Regards
Stefan

Rails is outputting £

I don't think this is a character set issue as I am displaying the £
sign elsewhere on the page (just as text not in a form element) and it
displays correctly.

···

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

I have managed to fix this using the CGI::unescapeHTML() method :slight_smile:

···

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