[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Displaying currency symbols in select

James Sturrock

8/17/2007 8:10:00 AM

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-....

6 Answers

Eric

8/18/2007 9:59:00 PM

0

Op vr 17 aug 10:10:04 2007 CEST schreef James Sturrock in
de nieuwsgroep 'comp.lang.ruby':

> 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?

Are u using a character set that contains the pound sign? (Like UTF-8)
--
Groeten,
Eric

Stefan Rusterholz

8/19/2007 1:15:00 AM

0

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-....

James Sturrock

8/19/2007 12:58:00 PM

0

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-....

Stefan Rusterholz

8/19/2007 3:42:00 PM

0

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-....

James Sturrock

8/20/2007 8:32:00 AM

0

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-....

James Sturrock

8/20/2007 12:57:00 PM

0

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

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