You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unicode characters in output should resemble Unicode characters in input, but currently don't.
I wanted to display the degree symbol (°, U+00B0) in a p5.js canvas, using the text() command. Pasting the symbol into code in the IDE presented no problem. However, the symbol does not display correctly, whether on the canvas or in the console:
var foo = "It is 30° outside";
text (foo, 20,20);
println (foo);
This produces the result:
It is 30° outside
A provisional fix was to use the Javascript Unicode representation for the degree symbol, '\xB0'. However I think this will really trap novice programmers.
var foo = "It is 30\xB0 outside";
text(foo, 20, 20);
println(foo);
The text was updated successfully, but these errors were encountered:
Unicode characters in output should resemble Unicode characters in input, but currently don't.
I wanted to display the degree symbol (°, U+00B0) in a p5.js canvas, using the text() command. Pasting the symbol into code in the IDE presented no problem. However, the symbol does not display correctly, whether on the canvas or in the console:
This produces the result:
A provisional fix was to use the Javascript Unicode representation for the degree symbol, '\xB0'. However I think this will really trap novice programmers.
The text was updated successfully, but these errors were encountered: