0

I have a javascript code containing subscript strings in an array e.g ["C₋₂" , "D₋₂", etc.] In local environment, the script works fine. However, in live web server, the string became ["C?2", "D?2"] which makes my whole script doesn't execute properly. Subscript characters don't retain. Is there anyway where I could 'escape' these characters?

LOCAL

enter image description here


LIVE

enter image description here

enrique
  • 134
  • 10
  • 1
    This is most likely due to character encoding. (Are you using UTF-8?). It would be great if you could post a code snippet or example of how you have the live web server set up. – Jacob Blomquist Jan 09 '21 at 05:19
  • @JacobBlomquist The file is loaded externally. When I click and open the source file 'locally' through a browser, the script looks good. While in my live website, I do the same thing but the strings messed up. – enrique Jan 09 '21 at 05:24
  • @JacobBlomquist Apologies for my choice of words. Posted a screenshot so it would be clear to understand. – enrique Jan 09 '21 at 05:30

1 Answers1

0

Finally, I found the answer. Thanks Jacob for giving me the hint. As what @Domorodec suggests, Notepad is only the answer. Copy and paste your code in Notepad and save it with UTF-8 Encoding.

enter image description here

Here's the link for the answer.

Please do note that the character may not be look as what you've expected it to be (weird characters will be printed in the javascript file), however, the code works fine it displayed the expected HTML text normally.

enrique
  • 134
  • 10