1. Technology

Notepad, Not WordPad

Common Mistakes Beginners Make When Trying to Edit a Page in Notepad

By

Wordpad or Notepad?

Wordpad or Notepad?

Screen shot by J Kyrnin © 2012 J Kyrnin - licensed to About.com

Notepad makes it very easy to get started with web design, because it's a free text editor that is on all versions of Microsoft Windows by default. But just because it's there doesn't mean that it has no challenges to using it. Here are some of the common mistakes that beginners make when trying to use Notepad to edit their HTML.

Notepad, Not Wordpad

A common mistake that beginners make is by first choosing the wrong program. Windows comes with another, similarly named program that you can use to edit textual documents: Wordpad.

The problem is, if you use Wordpad to write HTML and then attempt to view your page in a browser at best you are going to see gobble-de-gook and at worst the page won't load at all.

This is because Wordpad is not a text editor in the same sense as Notepad. Yes, you can use Wordpad to edit textual files, but when it saves the files, it saves in the format RTF or “rich text format.” It is possible to change Wordpad to save HTML as a text file, in a similar way you do with Notepad (changing the “Save As Type” to “Text Document” with the extension of .htm).

If you open the editor and there is a ribbon of tasks across the top of the window, then you are almost certainly in Wordpad. As you can see by the image above, Notepad is very plain with just the window and a few menus.

Save Your Documents as .htm

The challenge of using Notepad for writing HTML is that it automatically defaults to the .txt extension. This means that even if you add the extension .htm to your file name, Notepad will append a .txt to the end.

Then, when you test your files in a browser, the browser thinks it's a text file and shows all the HTML tags, rather than the web design. Also, if you link to that page, when you test that link it will be broken, because you linked to the filename.htm file name, which doesn't exist. The file is called filename.htm.txt.

To fix this, you can simply remove the .txt extension from the end of the file name. Windows may prompt you that you're changing the extension and so changing the type of the file. If it does, simply agree so that it uses the new .htm extension.

To prevent it from adding the .txt extension, you must change the “Save As Type” to “All Files” and including the extension .htm manually.

Notepad Can Be Problematic for Editing PHP

While it is possible to edit PHP in Notepad just like any other web page, it can cause problems. While Notepad is an ASCII text editor, it can have hidden characters embedded in the code that can cause problems with PHP. This happens if you hit the control or alt key and some character strings. While you can't see the characters in Notepad, they are still in the PHP file.

If you are getting an error message like:

header information has already been sent, cannot resend headers

Or another error in your PHP that you cannot explain, you should try opening the document in another text editor such as Crimson, jEdit, or EditPad. These editors will show the special characters that Notepad keeps hidden.

©2014 About.com. All rights reserved.