I am a web designer & developer based in Galway, Ireland. Information on my work is available from my company site: Ambient Age Web Design.

I am also completing a PhD in Information Systems. My research is on the Adoption of IT Standards for technologies to support Ambient Intelligence.

Replace the Euro Symbol (€) using Javascript (jQuery)

[Note: Techy / Programming content]

I spent a while on Friday searching for a way to replace the Euro symbol (€) in content pulled from a text area, using Javascript (jQuery). As it took me some time to track down an answer, here it is:

var theContent = $('#theTextArea').val().replace(/\u20ac/g, 'Euro');

This replaces using a global search to find instances of the euro symbol, and replaces them with the word “Euro”.  Using the actual Euro symbol (€) as the search pattern doesn’t work – so, for example, this won’t work:
.replace(/€/g, 'E');

Instead, this needs to be used: "\u20ac"

  • Twitter
  • del.icio.us
  • Google Bookmarks
  • Digg
  • Facebook
  • Technorati
  • StumbleUpon
  • Sphinn
  • DZone

8 Comments

Rene
April 10, 2009
12:19 pm
Permalink

Great hint! You made my day…

May 25, 2009
7:01 pm
Permalink

thx. I don’t even know what that \u20ac code is but after trying &eur; and € I’m glad this does work!

May 25, 2009
7:15 pm
Permalink

No problem, glad it helped.

20AC is the unicode for the Euro symbol . (…and it took quite a bit of searching before I figured that out :) ).

September 24, 2010
8:53 am
Permalink

No problem Mike, glad it helped!

Mike
September 24, 2010
9:52 am
Permalink

Thanks Dave! That saved me a hair pulling search.You’re still making someone’s day a year later!

João Carvalho
March 10, 2011
12:06 pm
Permalink

Thanks David!!! You just made Vera’s day :D

Ronald
November 2, 2011
3:22 pm
Permalink

YES!!
Finally! Thanks for this, saved my day.
Took me forever to find this.

January 31, 2012
10:47 pm
Permalink

Thank thank thank. Too long thinking it was my terminal encoding going nuts again.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*