WordPress.org

Ready to get started?Download WordPress

Forums

NEVER use notepad to edit php files (19 posts)

  1. dax702
    Member
    Posted 2 years ago #

    Just a word of suggestion for everyone. Never ever use notepad to edit php files. I spent the good part of 6 hours trying to figure out one of those white screen warnings. The WP FAQ was right about what the problem was, and that was junk characters at the beginning of my wp-config.php file. However, neither notepad nor notepad++ could see these characters. What's worse is that the FAQ says "notepad is fine" Well, based on the experience I just had, Notepad is NOT FINE. If you're going to edit php files, I suggest HTML Kit. It's free and it saw what the other two programs did not. Hope this posts saves someone some time that I wish I had back...

  2. Patrick Nommensen
    Member
    Posted 2 years ago #

    I like to use WordPad but I believe Notepad works fine for most of us.

  3. dax702
    Member
    Posted 2 years ago #

    I will never use notepad to edit a php file again, not after what happened. You can use it if you like, but if you run into white screen warnings, errors, check the file in HTML Kit

  4. ClaytonJames
    Member
    Posted 2 years ago #

    There is no valid reason - other than personal preference - not to use Notepad or Notepad++ for editing. I edit php files with Notepad++ every day (been using it for a long time), and it works just fine. I also use Notepad on occasion, and haven't had any problems (that I didn't create myself) with that either. Perhaps you just encountered an odd encoding issue.

  5. Patrick Nommensen
    Member
    Posted 2 years ago #

    Yeah, there shouldn't really be any issues.

  6. dax702
    Member
    Posted 2 years ago #

    I edit php files with Notepad++ every day (been using it for a long time), and it works just fine. I also use Notepad on occasion, and haven't had any problems

    I didn't create this problem myself either and up until today, I used notepad and notepad++ with no trouble. Bottom line is that it's possible that you can somehow end up with junk in your file that Notepad will not display and it can either drive you mad because you think your file is clean, or you can discover it right away using HTML Kit.

  7. ClaytonJames
    Member
    Posted 2 years ago #

    Bottom line is that it's possible that you can somehow end up with junk in your file that Notepad will not display

    Of course it's possible. Issues like yours can arise from encoding errors on occasion.

    You have found an editor that you are comfortable with, and that works for you. That's fantastic! That's what is important; finding something that works for you, and that you are comfortable in recommending to others. It just doesn't merit recommending that others not use Notepad or Notepad++. There isn't any sound basis for that advice. They are both longstanding, time proven tools, and they both work well. These things just pop up once in a while.

    Just for giggles, do you remember what the characters you found in the file using HTML Kit looked like before you removed them?

  8. dax702
    Member
    Posted 2 years ago #

    

  9. ClaytonJames
    Member
    Posted 2 years ago #

  10. dax702
    Member
    Posted 2 years ago #

    Well, I did not save the config file with any special options in notepad. Actually it was already there and I just edited it from time to time. So the question is, if I simply downloaded, edited, saved and re-uploaded the file, how did the BOM characters get in there? The wikipedia entry for BOM says "Many Windows programs (including Windows Notepad) add BOMs to UTF-8 files by default." So really, this just furthers the reasons for my abandonment of Notepad for php file editing.

  11. MickeyRoush
    Member
    Posted 2 years ago #

    ClaytonJames wrote:

    byte order mark

     characters

    dax702 wrote:

    So the question is, if I simply downloaded, edited, saved and re-uploaded the file, how did the BOM characters get in there?

    This happens quite often when using a .txt extension in Windows. Just Google search the issues that webmasters have with Google not being able to crawl their robots.txt file. You may have been working with a .txt file previously and your PC became buggy thereafter. If your using Windows anything can happen.

    What happens in Windows, stays in Windows. LOL

  12. dax702
    Member
    Posted 2 years ago #

    haha, now it's my pc that is buggy? Naa,,the fix is just don't use an editor that either cannot see the BOM, or creates the BOM "at random" Then again, now that I'm aware, at least I know HOW to check a php file for the BOM and it's NOT with notepad as the WP faq says is "ok"

  13. ClaytonJames
    Member
    Posted 2 years ago #

    NOT with notepad as the WP faq says is "ok"

    C'mon, guys/gals....

    Your pc probably isn't "buggy", and Notepad is perfectly acceptable and widely used for editing. It’s also unlikely that Notepad is directly responsible for your error. By default the encoding option in notepad is set to save as ANSI. However, when you save your changes, it also presents you with the option to save your .txt document as Unicode, Unicode big endian, or UTF-8. So there’s one possible avenue of accidental user error. Whether you want to think you made an accidental error or not, it's still possible.

    In the Notepad++ menu bar you will find an “Encoding” option. What is yours set to? Probably still ANSI, but there is a lot of options there as well. Two of those choices are: UTF-8 with, or without, BOM. So, there's another possible avenue of unintentional error or mistake. It just happens sometimes. There is nothing wrong with notepad as an editor. There are numerous other editors with lots of useful features, but there is nothing wrong with using notepad as a plain text editor in a windows environment.

  14. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    C'mon, guys/gals....

    This appears to be something of a personal crusade by the OP.
    http://wordpress.org/support/topic/re-warning-cannot-modify-header-information-headers-already?replies=13

  15. ClaytonJames
    Member
    Posted 2 years ago #

    Ahhh... I didn't see that. Well, you can lead 'em to water, but...

    :-)

  16. dax702
    Member
    Posted 2 years ago #

    I suppose it is somewhat of a personal, venting crusade. I only posted my experience because I don't want someone else to have to go through what I did the other day and waste so much time reading and reading only to find out that the FAQ is wrong. At the very least they should put something in there that says that Notepad cannot see the BOM.

  17. Pioneer Valley Web Design
    Member
    Posted 2 years ago #

    It probably all started by copying text with the offending BOM.

  18. klevismiho
    Member
    Posted 1 year ago #

    dax702 is right. I have similar problems with that, and I think too that the problem is in notepad++. Got myself mad a couple of times, the php was perfect, still there were displaying errors.
    For example I did a clean code, then after downloading with ftp (filezilla) the code looked like this:

    <?php /* theme options */ global $option_header_logo;global $option_home_banner;global $option_home_banner_y;global $option_header_text;global $option_main_header_text_color; ?>

    I am not sure if that's a notepad++ problem or not.

  19. antoniogallo
    Member
    Posted 1 year ago #

    I alway use VIM because it show me strange binary stuff when the encoding is not right. When forced on windows platform i always use notepad++ because its very easy to convert in-out of asccii--utf-8

    Personally i'm always trying to use UTF-8 anyway in my websites both databases and PHP files.

    Sometimes apache/php change content-type back from UTF-8 to Ascii if the PHP file is not recognized as UTF-8.

    My suggestion is to RTFM about Notepad++ and master it
    and maybe always try to save your files as "UTF-8 Without BOM".

    Or join the penguin power of VIM :)

Topic Closed

This topic has been closed to new replies.

About this Topic