How to get HTML5 canvas text to display html object?

I am parsing an xml file that stores data with images / headers that I need to display on my canvas. However, sometimes there is an object in the file and when drawing text on the canvas it is interpreted as flat text. How can I get © to display as & copy; on canvas? Is this possible, or does anyone know of a good job?

+4
source share
1 answer

You can replace HTML objects with equivalent Unicode characters.

eg.

 var x = 'This is © 2010'; x = x.replace( /©/, '\u00A9' ); // x is now 'This is © 2010' 
+5
source

Source: https://habr.com/ru/post/1307156/


All Articles