# Euro sign in Select box

**URL:** <https://www.ruby-forum.com/t/euro-sign-in-select-box/112791>\
**Category:** Rails\
**Created:** [August 23, 2007, 9:32am UTC](https://www.ruby-forum.com/t/euro-sign-in-select-box/112791 "2007-08-23T09:32:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![stalkert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@stalkert](https://www.ruby-forum.com/u/stalkert)\
**Post date:** [August 23, 2007, 9:32am UTC](https://www.ruby-forum.com/t/euro-sign-in-select-box/112791/1 "2007-08-23T09:32:26Z")

</div>

For hours I tried to get an Euro sign in my selectbox. Anyone have an  
idea how I can do this.

I try:  
\<%= select(“prijs”, “prijs”,  
['â‚¬12.500,‘12500’],  
[‘â‚¬25.000’,‘25000’]], :selected =\>  
session[:zoek\_prijs]) %\>

But I don’t get an Euro-sign. The browser is displaying a ?-sign. I  
tested it at several browsers. Any one an idea?

---

<div class="post-metadata">

**Author:** ![stalkert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@stalkert](https://www.ruby-forum.com/u/stalkert)\
**Post date:** [August 23, 2007, 9:43am UTC](https://www.ruby-forum.com/t/euro-sign-in-select-box/112791/2 "2007-08-23T09:43:54Z")

</div>

On 23 Aug 2007, at 09:32, Joost Saanen wrote:

> \<%= select(“prijs”, “prijs”,  
> ['EURO 12.500,‘12500’],  
> [‘EURO 25.000’,‘25000’]], :selected =\>  
> session[:zoek\_prijs]) %\>
> 
> But I don’t get an Euro-sign. The browser is displaying a ?-sign. I  
> tested it at several browsers. Any one an idea?

\<%= select(“prijs”, “prijs”,  
[‘€ 12.500’,‘12500’],  
[‘€ 25.000’,‘25000’]], :selected =\>  
session[:zoek\_prijs]) %\>

Should output something similar to:  
€ 100€  
200€ 300€ 400\</  
select\>

You could use the UTF-8 euro symbol itself: EURO  
But you’ll get into trouble if your webserver doesn’t serve pages as  
UTF-8 (i.e. it is sent in the headers). The € notation seems to  
be more applicable (if the euro sign is present in the font you’re  
using anyway).

Best regards

Peter De Berdt

---

<div class="post-metadata">

**Author:** ![stalkert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@stalkert](https://www.ruby-forum.com/u/stalkert)\
**Post date:** [August 23, 2007, 9:51am UTC](https://www.ruby-forum.com/t/euro-sign-in-select-box/112791/3 "2007-08-23T09:51:16Z")

</div>

Peter De Berdt wrote:

> On 23 Aug 2007, at 09:32, Joost Saanen wrote:  
> \<%= select(“prijs”, “prijs”,  
> [‘€ 12.500’,‘12500’],  
> [‘€ 25.000’,‘25000’]], :selected =\>

When I use this, the following HTML is generate by Mongrel (also using  
webrick)

&euro; 12.500

In my browser I see this in my selectbox:

€ 12.500  
€ 25.000  
etc.

---

<div class="post-metadata">

**Author:** ![stalkert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@stalkert](https://www.ruby-forum.com/u/stalkert)\
**Post date:** [August 23, 2007, 10:02am UTC](https://www.ruby-forum.com/t/euro-sign-in-select-box/112791/4 "2007-08-23T10:02:55Z")

</div>

On 23 Aug 2007, at 09:51, Joost Saanen wrote:

> When I use this, the following HTML is generate by Mongrel (also using  
> webrick)
> 
> &euro; 12.500
> 
> In my browser I see this in my selectbox:
> 
> € 12.500  
> € 25.000

Apparently Rails escapes the text, could be the only solution is to  
generate the select yourself instead of relying on the Rails helper:

\<% @myprices.each do |  
price| %\>\<%= price.readable\_value  
-%\>\<% end %\>

Best regards

Peter De Berdt

---

<div class="post-metadata">

**Author:** ![stalkert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@stalkert](https://www.ruby-forum.com/u/stalkert)\
**Post date:** [August 23, 2007, 10:33am UTC](https://www.ruby-forum.com/t/euro-sign-in-select-box/112791/5 "2007-08-23T10:33:18Z")

</div>

Peter De Berdt wrote:

> On 23 Aug 2007, at 09:51, Joost Saanen wrote:
> 
> > When I use this, the following HTML is generate by Mongrel (also using  
> > webrick)
> > 
> > &euro; 12.500
> > 
> > In my browser I see this in my selectbox:
> > 
> > € 12.500  
> > € 25.000
> 
> Apparently Rails escapes the text, could be the only solution is to  
> generate the select yourself instead of relying on the Rails helper:
> 
> \<% @myprices.each do |  
> price| %\>\<%= price.readable\_value  
> -%\>\<% end %\>
> 
> Best regards
> 
> Peter De Berdt

Hmmm… ok that is a solution, but what about the handy “:selected =\>  
session[:zoek\_prijs])” -part? Should I do this with if statements?

 geen voorkeur € 12.500 € 25.000 € 37.500 € 50.000 ... € 875.000

Is there not way to use the Rails helper?

---

<div class="post-metadata">

**Author:** ![stalkert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@stalkert](https://www.ruby-forum.com/u/stalkert)\
**Post date:** [August 23, 2007, 10:59am UTC](https://www.ruby-forum.com/t/euro-sign-in-select-box/112791/6 "2007-08-23T10:59:34Z")

</div>

problem solved!  
The text file encoding of my IDE (aptana) was wrong, I changed it to  
‘UTF-8’ and find and replace the bad euro signs with alt-0128 and now it  
looks fine.  
Thank for any help.
