0

I want to escape single and double quotes and some other characters in JavaScript

String to escape is `dynamic initializer for 'Graphics::CDeviceCMYK::s_WicFactoryBoundData''

I want to pass this as argument to some function.

I tried encodeURI(string);

Its not working. What's the correct way to do this ??

abhinav
  • 527
  • 3
  • 11
  • 24
  • Nope, I don't think it is a duplicate. He is asking how to declare this particular string in js source file. Not how to encode it. Cerbrus has provided the right answer – mara-mfa Feb 03 '14 at 11:41

1 Answers1

1

Just use double quotes (") to declare the string::

var str = "`dynamic initializer for 'Graphics::CDeviceCMYK::s_WicFactoryBoundData''"
Cerbrus
  • 70,800
  • 18
  • 132
  • 147