Plain text
A text editor is a computer program that lets you… edit text. More specifically, it lets you edit text directly, so you can create files on your computer that contain exactly the characters you type, without extra formatting information (usually) introduced in the file by, say, a word processing program (like Microsoft Word or Apple Pages).
What do I mean by “extra formatting information”? Well, take this document that I typed in a word processor:
Looks simple enough. But when I save this file onto my computer, and open it with a program (like a text editor!) that examines the data in the file directly without interpreting it, the resulting file is anything but simple. It looks like this:
That’s just a small screenshot of a large amount of garbage! That “garbage” is actually all of the data that Microsoft Word puts into the file, so that Word can remember all of the Word-specific things you put into your text (like formatting information, page breaks, font changes, etc.).
With a text editor, we can do two things:
- We can strip away formatting introduced into text by other programs, like web browsers and word processors, leaving behind “bare” text.
- We can directly edit the bytes of a file, without regard to how that file is normally displayed. For some file formats (like HTML), this is generally how files of that kind are authored to begin with. For other file formats (like, say, JPEGs or MP3s), editing files in this way is likely to cause “glitch” effects. (Which, in the case of our class, are desirable.)
We’ll be discussing the first use case in this document.
Using a text editor
Here I’ll be talking about text editors for two operating systems: TextEdit for OS X, and NotePad for Windows. Both of these text editors come with their respective operating systems—you don’t have to download anything extra.
NotePad
To open NotePad on Windows, go to your “Start” menu (generally the friendly Windows logo in the lower right-hand corner of the screen), and select “All Programs.” Click on “Accessories” and then “NotePad.” You should see a window that looks like this:
To open a file in NotePad, select the “File” menu and choose “Open.” Make sure to change the file type drop-down from “Text Documents” to “All Files”:
TextEdit
To open TextEdit on OS X, find your “Applications” folder and then double-click on “TextEdit” within. You can also use Launchpad (select the “Rocket” icon in your dock, or press the appropriate key on your keyboard—it’s F4 on my MackBook Air) or Spotlight (click on the upper right-hand corner of the menu bar, type “TextEdit” and hit Enter).
After you’ve opened TextEdit, you need to tell it to operate in “Plain Text” mode. To do so, click on the “Format” menu and select “Make Plain Text.”
You should be left with a window with no “chrome” or toolbars at the top, like this:
To open a file in TextEdit, use the “Open” dialog (“File” > “Open”), or drag the file to the TextEdit icon on the dock.
If you’re planning to edit HTML with TextEdit, make sure to follow the instructors here so that TextEdit displays “raw” HTML, instead of a WYSIWYG interface.
Removing formatting with a text editor
Once you have a text editor up and running, you can create “stripped” text by copying some source text from (e.g.) a word processor (like Word) or a web browser, then pasting it into the text editor. Because the text editor has no understanding of formatting, everything except the letters (and some line breaks) will be lost. Here’s a demonstration with Chrome and NotePad:
Here, I select the entire front page of the New York Times using Ctrl+A (Command+A on OS X), then paste it into the text editor with Ctrl+V (Command+V on OS X). The resulting text file has all the same text, but without any of the formatting.
Stripped of its formatting, the text takes on a whole new context. Text in this format is also easier to input into various tools for text filtering and analysis (as we will see shortly).
Doing things with plain text
Plain text is infinitely malleable. With plain text, you can (among other things)…
- Systematically replace some strings of text with other strings of text (find and replace)
- Change where the line breaks occur (“word wrap”)
- Sort lines in alphabetical order
- Randomize the lines
- Combine different text together
- Change the text encoding
Some of these functions might be directly available in your text editor. Others, you’ll need to find specialized software for. I recommend playing around with the tools at TextMechanic.com, which all operate in a similar way: you paste in some plain text, specify some parameters, click a button, and get transformed text on the bottom of the screen. (You can then take the resulting text and feed that to another tool.)
Here’s an example of using TextMechanic.com’s “Add/Remove Line Breaks” tool to add some dramatic enjambment to the New York Times:
Copy the output from that, and paste it as input to the “Remove Lines Containing” tool. You can make something that looks a bit like a poem:
Now copy the output from that and pass it into the “Random Line Picker” tool. Click “Pick Random Line” a couple of times. Now we’ve got something interesting!
As this example shows, taking text out of its original context and using tools that work on the “raw” bytes and characters has tremendous creative potential.
Using text editors to “glitch” binary data
Text editors don’t just work on text! They allow you to manipulate the raw bytes of any file, regardless of format. Most of the time, doing this is a Bad Idea, since it’s easy to corrupt a file this way, or render it entirely unusable.
But it’s also possible to seek out the effects of corruption, toward artistic ends. This is the art of the “glitch.” There are a number of tutorials available for glitching files with text editors; here are a few:
- A Glitch Primer: Editing Image Files With Text Editors
- Animals Within Animals “Databending and glitch art primer”:
- Databending (from Intelligent Machinery)
The basic workflow is this:
- First, make a copy of the file you want to glitch/bend. Only work on this version, so you don’t accidentally destroy your original file.
- Open a “binary” file, like a JPEG, PNG or MP3 in a text editor. (It’s probably better to experiment on smaller files—the smaller the better, say less than a megabyte.)
- Make some changes to the text file. Generally, it’s better to make your changes later in the file—say, halfway through. (The data at the beginning of the file is generally the most fragile.) You might:
- Delete some text.
- Copy some text and then paste it somewhere else.
- Copy in some text from another source
- Save the file.
- Open the file in an application normally designed to open files of that type (say, a web browser). See what happened!
If the file doesn’t open (or if you get a message to the effect of “This file’s version is unrecognized”), you might have inadvertently mangled the file beyond repair. No problem, though! Just start over from a fresh copy and try something else.
Some hints:
- If you can’t get one text editor to work, try another. For Windows, I recommend NotePad++; for OS X, try TextWrangler.
- Try opening the file in more than one program. A file that is broken in Chrome might work in Paint (and vice-versa).
- As a corollary to the above: Take a screenshot! You can’t be sure that a glitched file will work on someone else’s computer (or web browser), so a better way to document your work is to take a screenshot of the rendered file. (If you’re working with audio or video, make a recording and post that, instead of/in addition to your glitched file.)
Sources for raw material:
- For text, try Project Gutenberg.
- For images: Wikimedia Commons.
- Freesound has a great collection of searchable and sortable MP3 clips. (Free to use, but registration is required.)