Menu

Notepad appending characters to beginning

2007-10-04
2012-11-13
  • Nobody/Anonymous

    I'm having a problem when I write Perl scripts with Notepad++ and run them server-side.  My server is *nix running Apache.  I have set it to save in UNIX format, with UTF-8 character encoding.  When I go to run the script, instead of running, it is displayed.  So I write the program in another editor and use a compare tool on the two files.  They are identical except that the Notepad++ file has a character (not visible in the editor) before the shebang (#!), therefore causing the script to break.  Anyone know what this is and how to stop it from happening?  I'm in the habit of writing in Notepad++ then copy-paste to another edit to save

     
    • Reijo Tomperi

      Reijo Tomperi - 2007-10-04

      "Although not part of the standard, many Windows programs (including Windows Notepad) use the byte sequence EF BB BF at the beginning of a file to indicate that the file is encoded using UTF-8. This is the Byte Order Mark U+FEFF encoded in UTF-8, which appears as the ISO-8859-1 characters "" in most text editors and web browsers not prepared to handle UTF-8."

      http://en.wikipedia.org/wiki/UTF-8#Windows

       
      • Nobody/Anonymous

        Changed it to ANSI and it went away.  Thanks for the tip

         
        • Nobody/Anonymous

          If you want to encode in UTF-8 (which I do), ver 4.7.5 has the option "UTF-8 without BOM," which removes the Byte Order Mark U+FEFF. This can cause some problems with Windows Apps, but I save with unix style line-feed only newlines, so I'm already causing Windows problems.

           
MongoDB Logo MongoDB