1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

CGI File not working after copying to word doc and back

Discussion in 'Programming' started by MindReality, Feb 17, 2020.

  1. #1
    When I open a CGI file in txt file and edit the code and save it and run it, it works as normal.

    But when I copy the code over to word doc and copy it back to the CGI file and save it and run it, it does not work.

    Why is that? I did not even make any changes to the code. Just copying to word doc and back and saving it and the CGI file does not work.
    MindReality, Feb 17, 2020 IP
  2. sarahk

    sarahk iTamer Staff

    Likes Received:
    Best Answers:
    Trophy Points:
    Word is a bit like HTML

    There's what you see, and then there's the "source code"

    When you copy back from Word you get all the Microsoft specific source code that comes with it and your cgi programme "can't deal"

    Paste into notepad, select all, copy and then save as the cgi file

    but no programming code should every go anywhere near a Word page, ever. There are much better editors out there like netbeans, sublimetext, notepad++, and even Microsoft's own notepad program
    sarahk, Feb 17, 2020 IP
    mmerlinn likes this.
  3. NetStar

    NetStar Notable Member

    Likes Received:
    Best Answers:
    Trophy Points:
    Most likely due to the line endings. For instance, on Unix the line endings are a Line Feed (\n) and on Windows it's a Carriage Return AND Line Feed (\r\n). Carriage Returns in a script on a Unix server will break. Wordpad replaces each Line Feed with a Carriage Return. This will break your script. You need a programmers editor like sarahk suggested.
    NetStar, Feb 24, 2020 IP
  4. MindReality

    MindReality Well-Known Member

    Likes Received:
    Best Answers:
    Trophy Points:
    Thank you both! I have decided to use sublimetext. :)
    MindReality, Feb 24, 2020 IP