javascript - JS backslash escape char being converted to non-escaping character by Shift JIS -


i'm working on website has 2 versions, 1 american website that's served utf-8 , 1 japanese version that's served shift jis. site generated using perl.

the problem:

i'm serving javascript akin following.

var text = "test \"quote\""; 

which, on japanese site, returning error "uncaught syntaxerror: unexpected identifier." because backslash being converted elongated backslash character \, isn't seen escape character , breaking line.

i can't seem find else running problem makes me suspicious there isn't fundamentally wrong our website. has encountered similar situation , found solution?

many thanks

i found helpful information here:

why browser showing different slash email validation regex. how prevent that?

which lead me upsetting hack:

var text = "test ¥"quote¥""; 

this works perfectly. now, isn't way it, enable other devs on testing other js interactions on site while concentrate on refactoring code doesn't rely on character escaping. hope information helps else @ point!


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -