June25
Euro Symbol in Ruby
I have been using a ruby based functional testing tool that I wrote to test a clients web application. The web application uses different currency symbols of which most were quite happily handled by default within ruby.
However the Euro symbol was a bit more of a problem. Just pasting in the € symbol didn’t work out so instead I had to dig around for some help and I found this useful ruby-forum topic where someone had a similar problem: Euro currency symbol
Right at the bottom I found what I was looking for. A way to replace the euro symbol in my string with some ruby code that could generate the right symbol:
# The string I wanted to use to set a drop
# down select option on a form
"HUB € DAH Argus (Mid)"
# The solution
euro_symbol = [8364].pack("U")
"HUB #{euro_symbol} DAH Argus (Mid)"
Latest Comments
"Very nice. Used to access
nick xidis / 20.Jul.2009 at 11:29pm
"Thanks Mark – I have put ..."
kingsley / 24.Jun.2009 at 11:10am
"Nice work! Could you publish th..."
mark yoon / 10.Jun.2009 at 05:03pm
"Totally! Ruby is a great freest..."
raymond barlow / 14.Feb.2009 at 03:08pm