Tapatalk

copy/paste code from pdf gives error due to weird quotes.

copy/paste code from pdf gives error due to weird quotes.

1
NewbieNewbie
1

    Jan 14, 2009#1

    I'm learning about php from a book in pdf format. When I copy/paste the code to test it out it gives an error because the quotations in the code are different (noticed them because they look different). I have to go through all the code and retype all the quotes to make the code work.

    Anyone know why this is and how I can copy paste without having to retype all the quotes?

    236
    MasterMaster
    236

      Jan 14, 2009#2

      They probably use typographical quotes in your book, and PHP expects the "standard" quotes. The first thing that comes to mind is to do a search and replace after pasting.

      You could, for example, do a Perl regular expression search for
      [„“”]
      and replace all with
      "

      and/or replace [‘’‚‛] with '

      Addition by Mofi: You should contact the author of the book and report that all the PHP examples are not working because of using ANSI instead of ASCII quote characters as required for PHP (and all other programming languages).