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?

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}, 
         ... ],
       ...
    }); 
3
  • does it solve your issue ? 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.
    – lida
    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 . Jan 16, 2017 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.