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.
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
To include a Unicode character in a Javascript string, just use a Unicode escape sequence:
root.streakAngle.text = streakAngle + "\u00B0";
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
Copy link to clipboard
Copied
To include a Unicode character in a Javascript string, just use a Unicode escape sequence:
root.streakAngle.text = streakAngle + "\u00B0";