Log in

View Full Version : Money Signs



Webiter
11-01-2011, 02:52 PM
When I input the sign $ into the code below it presents as a Dollar Sign as required when rendered in the Browser.:)


<select name="amount" class="dropdown">
<option value="500">$500</option>
<option value="100">€100</option>
<option value="50">€50</option>
<option value="20">€20</option>
<option value="10" selected="selected">€10</option>
</select>

How can the € sign be inputed to render as a Euro Sign? :o
See descriptive image attached.

traq
11-01-2011, 03:26 PM
you need to use proper character encoding. You should use UTF-8 encoding in your documents if you need to use uncommon (from a U.S. perspective) characters.

Beyond that, you need to make sure your server sends the correct character encoding declaration, and include your character encoding in your html <head>:
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<!--the character encoding should be declared as early as possible-->
<!--note that the header sent by the _server_ is more important
(browsers may ignore your meta tag in favor of such http headers)-->


alternatively, you can simply use htmlentities: &euro; (or €) renders as € .

but using utf-8 is a FAR superior solution, and solves this problem for just about any character you may use.

Webiter
11-01-2011, 03:53 PM
The &euro; worked. Thanks for the alternative.

I already had the <meta charset="UTF-8"> in the head. Just running the script in Firefox from Notepad++ and render was presenting the ? in a dark diamond in lieu of the € sign!

traq
11-01-2011, 08:26 PM
The &euro; worked. Thanks for the alternative.Glad it worked.

I already had the <meta charset="UTF-8"> in the head. Just running the script in Firefox from Notepad++ and render was presenting the ? in a dark diamond in lieu of the € sign!
two things to check:

1) make sure you are really using utf-8. Setting the character encoding is _useless_ (counterproductive, even) if it's not set correctly.

2) make sure your _server_ is setting the same character encoding. the meta tag is only a "fallback." The http header sent by the server is what really matters.

(in this case, there is no http header (since you're viewing it locally, from notepad++), so I would tend to think that you're not actually using utf-8 in your document - either that, or Windows is overriding the document encoding with the system setting for some reason. you can check (and change) the character encoding from notepad++.)