Everytime, I want to copy and paste one Javascript code example from a book (in a pdf version) to Sublime Text or Textmate, any " " become “ ” >> the code doesn't work.

Is there any way to fix this ?

Thanks in advance.

Config: OSX Lion, PDF reader : Skim

Update: For Textmate. the solution is here.

2 Answers 2


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.

  • Thanks. The curly quotation marks look like as quotation marks in the PDF.
    – politicus
    Commented Jan 26, 2012 at 13:31
  • I'm pretty sure this is all down to using Microsoft Word as a document source due to its "Smart quotes", but the quotes as they appear in the PDF will look different depending on the font used
    – Stu Wilson
    Commented Jan 26, 2012 at 17:01

Some text editors like BBEdit or TextWrangler have a built-in command to straighten so-called "smart" quotes.

enter image description here

It does not appear the the two text editors you cite as examples have built-in commands for this, so either search and replace or a plugin is the solution.

  • Thanks for the info. I founded 2 commands for Textmate that solve the problem. I wish i could could find one for sublime text 2.
    – politicus
    Commented Jan 29, 2012 at 9:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .