HTML Canvas - Add UNICODE or HTML Entity etc to Dynamic Text Field?

Engaged ,
Mar 20, 2022 Mar 20, 2022

Copy link to clipboard

Copied

How do I add UNICODE or HTML Entity etc to a dynamic text field??

 

E.g. 

root.streakAngle.text = streakAngle + '°';

  doesn't render ° as a degree symbol.

Views

56

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Adobe Community Professional , Mar 20, 2022 Mar 20, 2022
Hi. There are several ways of doing this. Here's just a suggestion: // "003E" is the unicode without the "U+" part this.yourTextField.text = String.fromCharCode(parseInt("003E", 16)); This answer may give you more ideas: https://stackoverflow.com/questions/17267329/converting-unicode-character-to-string-format Regards, JC

Likes

Translate

Translate
Adobe Community Professional , Mar 21, 2022 Mar 21, 2022
To include a Unicode character in a Javascript string, just use a Unicode escape sequence: root.streakAngle.text = streakAngle + "\u00B0";

Likes

Translate

Translate
Adobe Community Professional ,
Mar 20, 2022 Mar 20, 2022

Copy link to clipboard

Copied

Hi.

 

There are several ways of doing this. Here's just a suggestion:

// "003E" is the unicode without the "U+" part
this.yourTextField.text = String.fromCharCode(parseInt("003E", 16));

 

This answer may give you more ideas:

https://stackoverflow.com/questions/17267329/converting-unicode-character-to-string-format

 

Regards,

JC

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Mar 21, 2022 Mar 21, 2022

Copy link to clipboard

Copied

LATEST

To include a Unicode character in a Javascript string, just use a Unicode escape sequence:

root.streakAngle.text = streakAngle + "\u00B0";

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines