Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to show unicode characters in a HTML input type=submit value?

A customer has a designer mockup of a form button that shows a right facing triangle character after the main text, but I can't seem to get this showing. The offending markup is;

    <input type="submit" value="Add to basket &#9654;" />

This should look like 'Add to basket ▶' (if it renders in your browser).

Is this possible or am I doing something wrong?

A jquery workaround is acceptable as a hack too. The page is HTML5 compliant, maybe that'll help.

Thanks in advance,

Ryan

Update: The answers below are correct, there was an easier way though, I just copied the triangle out of this question and straight into me HTML editor. No encoding needed.

Thanks all.

like image 255
Ryan O'Neill Avatar asked Sep 02 '10 13:09

Ryan O'Neill


2 Answers

Ya you can use 100%

just ensure

Content-Type: text/html; charset=utf-8

should be present.

The meta tag is ignored by browsers if the HTTP header is present.

Also ensure that your file is actually encoded as UTF-8 before serving it, check/try the following:

Ensure your editor save it as UTF-8.

Ensure your FTP or any file transfer program does not mess with the file.

like image 151
Pramendra Gupta Avatar answered Oct 05 '22 02:10

Pramendra Gupta


Try this:

<button type='submit'>Add to basket &#9654;</button>

It has the same effect as <input type='button'>, but you can also write charset inside.

I hope this helps.

like image 32
Mendy Avatar answered Oct 05 '22 03:10

Mendy