开发者

Javascript replace() doesn't work in VS - unknown character

开发者 https://www.devze.com 2022-12-19 07:23 出处:网络
I\'m trying to use the javascript replace function to replace curly quote with straight quotes: var EditedContent = content.replace(/“/g, \'\"\');

I'm trying to use the javascript replace function to replace curly quote with straight quotes:

var EditedContent = content.replace(/“/g, '"');

This works great in a little proof of concept html file I've whipped up, but when it's in a visual studio project, it replaces the curly quote with a symbol that suggests 开发者_开发问答'unknown character':

Javascript replace() doesn't work in VS - unknown character

How can I resolve this issue so that I can use the application properly when debugging?


Use unicode:

... = content.replace(/\u201C/g, '"');

You can find unicode equivalents of various quotes here.

0

精彩评论

暂无评论...
验证码 换一张
取 消