1

I am editing javascript code of ArcGIS API for JavaScript for online map.

the piece of code is here:

var lvEsriPopupT = new esri.dijit.PopupTemplate(
 { 
 "title": "Weather",
 "outFields": "*",
 "fieldInfos": [{
 "fieldName": "Temperature",
 "label": "Temperature deg& C",
 "visible": true}, 
 ... ],
 ...
 }); 

The code works fine. the issue that I am trying to fix, is displaying the degree symbol inside double quotes. anything I tried (° ℃ ℃) comes ups without being decoded to the actual symbol. I suspect it is because it is inside double quotes.

Is there a solution for that?

Bourbia Brahim
9471 gold badge6 silver badges15 bronze badges
asked Jan 13, 2017 at 2:07

1 Answer 1

3

Why Didn't you use directly the ° character ?

otherwise use js String.fromCharCode function to render char from It's ascii code (degree = 176 ) like bellow :

var lvEsriPopupT = new esri.dijit.PopupTemplate(
 { 
 "title": "Weather",
 "outFields": "*",
 "fieldInfos": [{
 "fieldName": "Temperature",
 "label": "Temperature "+String.fromCharCode(176)+"C",
 "visible": true}, 
 ... ],
 ...
 }); 
answered Jan 13, 2017 at 10:57
3
  • does it solve your issue ? Commented Jan 16, 2017 at 7:11
  • Thank you! Your solution worked perfectly. I tried to use ° character but in my code editor (notepad ++) it would change to normal o. Commented Jan 16, 2017 at 7:58
  • Great :) , So please up and mark the answer as resolved ✓ (left the answer ) ( like in this image =>image resolve post ) thank you . Commented Jan 16, 2017 at 9:04

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.