• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

352

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

Community Expert , 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

Votes

Translate

Translate
LEGEND , 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";

Votes

Translate

Translate
Community Expert ,
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

Votes

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
LEGEND ,
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";

Votes

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