0

I tried to run my code in my google chrome browser (version:71.0.3578.98) on a local python https server but when I try to run it the "C°" is "C°". When I lock in the developer tools it is the same but in the code I have on my Desktop it's "C°" and not "C°".

I tried to use diffrent Browsers (FireFox, Opera) but nothing works. I found out that when I download the chrome plugin (Set Character Encoding) and set the encoding to UTF-8 it works and there stands "C°" but why is chrome this not doing by default

var temp = 5;
var str = "Now: " + temp + "C°";
console.log(str);

I expected that the chrome browser shows my "Now: 5C°" and not "Now: 5C°".

MrMugame
  • 15
  • 4

2 Answers2

0

You could try to use the Hex value to see if it works:

var temp = 5;
var str = "Now: " + temp + "C\xB0";
console.log(str);

If i understood correctly your problem is explain here : http://mc-computing.com/languages/Javascript/Degree_Symbol/Degree_Symbol.html

0

Please check your character encoding in HTML <head> element.

Add following line in element of your webpage:

<meta charset="utf-8">