简体   繁体   中英

How to I replace certain letters from javascript inside javascript?

I get out "Å, Ä, Ö" like this "Ã ¥, Ã ¤, Ã ¶" when printing data from an external JSON file. This file has the wrong encoding, but I can not do anything about that file because it is from an API. But, is there a painless way of getting all "1" replaced with "A"? I tried getting a UTF-8 encoded tag in my HTML document. Not helping.

尝试使用正则表达式替换:

 wholetext.replace(/1/g,'A')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM