Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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 : http://goo.gl/3r3xI

share|improve this question

2 Answers 2

up vote 2 down vote accepted

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.

share|improve this answer
    
Thanks. The curly quotation marks look like as quotation marks in the PDF. –  politicus Jan 26 '12 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 Jan 26 '12 at 17:01
    
Thanks for the info. –  politicus Jan 26 '12 at 17:24

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.

share|improve this answer
    
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 Jan 29 '12 at 9:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.