WordStar

WordStar was a word processor originally released in 1978 which was extremely popular in the early 1980s before losing ground to other word processors (particularly WordStar). Many professional writers used it in that era, and given their notorious conservatism regarding tools used for their writing, some are still using it to this day. This means that many original manuscripts are stored in this format.

The original version was for the CP/M operating system, but it was later ported to a number of other systems; the PC/MS-DOS version became the most popular one. The particular set of control keys used for accessing various functions (often requiring multiple keypresses) were widely imitated in other programs at the time, making a "de-facto standard" for editing keys that got even wider use than WordStar itself.

As with many early word processors, its files were basically plain text, with optional special functions causing control characters to be inserted. Files could be created or edited with any extension, but .wp (sometimes with an appended number to mark versions, like .wp3) was commonly used.

One quirk present in versions prior to 5.0 was its use of the high bit of each byte of its files to denote the last letter of a word. This limited the character set to 7-bit ASCII, where all characters in the document that were not the last letter of a word had a clear high bit (and thus had values from 00-7F hex corresponding to the ASCII values), while last letters had the high bit set (giving them values from 80-FF hex, but actually representing the corresponding characters from 00-7F). This interfered with internationalization, since it prevented the use of extended character sets beyond ASCII, and also resulted in WordStar files having characters at the end of words that looked like gibberish in other programs which interpreted the characters via some 8-bit encoding. Eventually this "feature" was dropped, but even in late versions extended characters were marked in the saved files by control characters both preceding and following them, making an 8-bit character take three bytes to store, which was necessary to preserve file compatibility (old WordStar files with high bits set at the end of words still needed to load correctly meaning that the program couldn't interpret high-bit characters as other characters in extended character sets without a special marker).

Converting WordStar files with high bits set
Some other programs have special "WordStar import" features which handle high-bit characters, but if you need to deal with such files without a conversion utility, it's helpful to change high-bit characters to their corresponding 7-bit characters in order to have standard ASCII. This can be done simply in most programming or scripting languages; here's a Perl example, for instance.

open OUTFILE, ">out.txt"; open INFILE, ") {  tr [\200-\377] [\000-\177]; print OUTFILE $_; } close INFILE; close OUTFILE;

Control characters
These are the control characters as stored in WordStar documents, and their meanings. Most of them are program-specific, not corresponding to the standard ASCII control meanings, though some of these are preserved. The toggle options were used at the start and end of blocks of text intended to be formatted in a particular way (e.g., bold).

Dot commands
These commands are intended to be on a line by themselves, and started with the dot (.). This meant that regular text lines couldn't start with dots. Many other early word processors emulated WordStar in their use of "dot lines" for commands, though some of them required a control character to precede the dot in order to allow dots at the start of normal text lines. The specific commands varied a lot between programs, however.


 * .. Comment line (followed by comment text; not printed)