D3.js text element does not display unicode character correctly
2 answers
➤
- HTML / XML markup. You are not pasting in HTML / XML source code, so these screens do nothing. You can simply:
.text('➤');
And save the file in the same encoding that the browser will read (usually UTF-8 for a page with <meta charset="utf-8"/>
.
If you really can't use non-ASCII characters, for example because your script must be included from multiple pages with different character sets, or because your text editor doesn't support Unicode, then the type of escape code you want to use JavaScript string literal encoding. ➤ - U + 27A4 Black right arrow, so:
.text('\u27A4');
+6
source to share