Javascript - Degree Symbol Test
UTF-8 version 
This page is part of the documentation and testcases related to
the issue of displaying a Degree Symbol (°) on web pages
via html and javascript.
This test file 
 - Is saved with UTF-8 encoding 
 
In all the test files, text is placed on a canvas using javascript code similar to the following.
context.fillText("25°C", 100, 100);
 | 
Also in all test files (html and javascript), viewing the above text in notepad
shows the Degree Symbol as (°) (this one is rendered as °
so that the html file encoding won't matter).
It turns out that there are 2 different ways for a text file to store the degree symbol
 - As a regular ASCII character (ANSI in the Encoding option when saving a file)
 
 - As a UTF-8 character (Another Encoding option)
 
Both of these will display the exact same in notepad,
but differently when creating a web page - depending on the browser and a variety of combinations.
 
  The Testcases 
The following table encapsulates the testcases and is identical in all 4 html files -
UTF8
ANSI
ANSI with Chrome Failure
ANSI with meta tag
 - There are 3 canvases - each written to by javascript in a different file
 - Local HTML - Uses javascript in the current html file
 
 - ANSI js - Uses Degree_Symbol_ANSI.js
 
 - UTF-8 js - Uses Degree_Symbol_UTF8.js
 
  - A code sample - Besides the text file encoding, all 3 javascript routines are identical except for
 - The function name
 
 - The id of the canvas object
 
 - The temperature value
 
 
 | Testcases using the associated code
  | 
|---|
| Canvases  | Sample code
  | 
|---|
| Local HTML  | ANSI js  | UTF-8 js 
  | 
|---|
| 
 | 
As you can see (depending on which scenario you are observing), 
when that code executes and the Degree Symbol is placed on a canvas,
it may be rendered as either a small superscript circle or as 
a black diamond with a question mark.
Author: 
Robert Clemenzi