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

3
  • 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. Commented Jan 9, 2021 at 5: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. Commented Jan 9, 2021 at 5:24
  • @JacobBlomquist Apologies for my choice of words. Posted a screenshot so it would be clear to understand. Commented Jan 9, 2021 at 5:30

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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.