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;
&开发者_开发问答lt;input type="submit" value="Add to basket ▶" />
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.
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.
Try this:
<button type='submit'>Add to basket ▶</button>
It has the same effect as <input type='button'>
, but you can also write charset inside.
I hope this helps.
Yes it is possible.
Make sure to use utf-8 meta:
<meta charset=utf-8 />
See the late Alan Flavell's page FORM submission and i18n about the issue. It's years old but, as far as I know, still relevant.
In short: form submission happens in the same encoding as the html page itself is in. So you have to provide a usable encoding for the html page.
精彩评论