ASCII character in select box

Hi all,

I've been searching for hours trying to find a way to display the euro symbol using the select method. My code is as follows:

addresses = @cart.company.delivery_addresses.map {|a| [a.description, a.id]} addresses << ["Other address &euro; 5,00",0] select "delivery_address", "address_id", addresses

The problem is that rails makes the input html save, does anyone have an idea how to accomplice this?

So you need to include the character directly. Assuming your output encoding is UTF-8 (default in latest Rails), you can do something like:

   euro = [8364].pack('U')    addresses << ["Other address #{euro} 5,00",0]

I don't know if Ruby accepts UTF-8 source code, but if it does, you could just insert the character directly (if your editor can do that).

Cool, works great (both the direct and indirect method).

Thanks for the quick reply (and the answer).