How to copy and paste Javascript code from a PDF file to a texteditor (Textmate or Sublime Text)
That's probably because the PDF uses actual curly quotation marks (which are indeed syntactically incorrect). The most straightforward thing to do would be performing a search and replace on the copied text in your text-editor.