javascript - Need to escape " , ' along with other UNICODE characters -


i have following string :

"ѯѰѱѲ & <b>bold</b> <>?:"{}|+_)(*&^%\\\\\\$#@!~`,./;'[]\ 

(with starting " , " in middle).

i tried following 3 functions : escape, encodeuri , encodeuricomponents.

however 3 give error of : syntaxerror: unexpected token { due presence of starting " closing middle ".

i not want use regex replace escape " , ' in string. there direct js/jquery function same?

code: earlier doing : e.title.tolowercase().indexof(encodeuricomponent($scope.nametosearch.tolowercase())) 

or have hardcoded

for hardcoded version, put in quotes escapes quotes , backslashes:

// quotes v                                                                 v var str = '"ѯѰѱѲ & <b>bold</b> <>?:"{}|+_)(*&^%\\\\\\\\\\\\$#@!~`,./;\'[]\\'; // escapes -------------------------------------^-^-^-^-^-^-----------^---^ 

Comments