RFC 678 UNKNOWN DOCUMENT FORMAT · FILE TRANSFER · INTEROPERABILITY

Standard file formats

Standard file formats for document interchange across different systems

On rfc-editor.org ↗
PUBLISHED
December 1974
AUTHORS
J. Postel
STREAM
Legacy
STANDARD FORMATS
6
FORMAT 1 PAGE SIZE
60 lines × 72 characters
FORMAT 3 PAGE WIDTH
132 characters
FORMAT 4 CARD WIDTH
80 characters
DOI
10.17487/RFC0678

RFC text

Contents
Original text · RFC Editor View on rfc-editor.org ↗
Network Working Group                                          J. Postel
Request for Comments:  678                                     (SRI-ARC)
NIC:  31524                                             19 December 1974



                         Standard File Formats




Introduction

   In an attempt to provide online documents to the network community we
   have had many problems with the physical format of the final
   documents. Much of this difficulty lies in the fact that we do not
   have control or even knowledge of all the processing steps or devices
   that act on the document file. A large part of the difficulty in the
   past has been due to some assumptions we made about the rest of the
   world being approximately like our own environment. We now see that
   the problems are due to differing assumptions and treatment of files
   to be printed as documents. We therefore propose to define certain
   standard formats for files and describe the expected final form for
   printed copies of such files.

   These standard formats are not additional File Transfer Protocol data
   types/modes/structures, but rather usage descriptions between the
   originator and ultimate receiver of the file. It may be useful or
   even necessary at some hosts to construct programs that convert files
   between common local formats and the standard formats specified here.

   The intent is that the author of a document may prepare his/her text
   and store it in an online file, then advertise that file by name and
   format (as specified here), such that interested individuals may copy
   and print the file with full understanding of the characteristics of
   the format controls and the logical page size.

Standardization Elements

   The elements or aspects of a file to be standardized are the
   character or code set used, the format control procedures, the area
   of the page to be used for text, and the method to describe
   overstruck or underlined characters.

   The area of the page to be used for text can be confusing to discuss,
   in an attempt to be clear we define a physical page and a logical
   page. Please note that the main emphasis of this note is to describe
   the standard formats in terms of the logical page, and that it is up
   to each site to map the logical page onto the physical page of each
   of their devices.

                                                   Standard File Formats
                                                Standardization Elements



      Physical Page

         The physical page is the medium that carries the text, the
         height and width of its area are measured in inches.

            The typical physical page is a piece of paper eleven inches
            high and eight and one half inches wide.

               Typical print density is 10 characters per inch
               horizontally and 6 characters per inch vertically. This
               results in the typical physical page having a maximum
               capacity of 66 lines and 85 characters per line. It is
               often the case that printing devices limit the area of
               the physical page by enforcing margins.

      Logical Page

         The logical page is the area that can contain text, the height
         of this area is measured in lines and the width is measured in
         characters.

            A typical logical page is 60 lines high and 72 characters
            wide.

   Code Set

      The character encoding will be the network standard Network
      Virtual Terminal (NVT) code as used in Telnet and File Transfer
      protocols, that is ASCII in an eight bit byte with the high order
      bit zero.

   Format Control

      The format will be controlled by the ASCII format effectors:

         Form Feed       <FF>

            Moves the printer to the top of the next logical page
            keeping the same horizontal position.

         Carriage Return <CR>

            Moves the printer to the left edge of the logical page
            remaining on current line.

                                                   Standard File Formats
                                                Standardization Elements



         Line Feed       <LF>

            Moves the printer to the next print line, keeping the same
            horizontal position.

         Horizontal Tab  <HT>

            Moves the printer to the next horizontal tab stop.

               The conventional stops for horizontal tabs are every
               eight characters, that is character positions 9, 17, 25,
               ... within the logical page.

            Note that it is difficult to enforce these conventions and
            it is therefore recommended that horizontal tabs not be used
            in document files.

         Vertical Tab    <VT>

            Moves the printer to the next vertical tab stop.

               The conventional stops for vertical tabs are every eight
               lines starting at the first printing line on each logical
               page, that is lines 1, 9, 17, ... within the logical
               page.

            Note that it is difficult to enforce these conventions and
            it is therefore recommended that vertical tabs not be used
            in document files.

         Back Space      <BS>

            Moves the printer one character position toward the left
            edge of the logical page.

      Not all these effectors will be used in all format standards, any
      effectors which are not used in a format standard are ignored.



   Page Length

      The logical page length will be specified in terms of a number of
      lines of text.

                                                   Standard File Formats
                                                Standardization Elements



   Page Width

      The logical page width will be specified as a number of
      characters.

   Overstriking

      Overstriking (note that underlining is a subset of overstriking)
      may be specified to be done in one or both of the following ways,
      or not at all:

         By Line

            The composite line is made up of text segments each
            terminated by the sequence <CR><NUL> except that the final
            segment is terminated by the sequence <CR><LF>.

         By Character

            Each character to be overstruck is to be immediately
            followed by a <BS> and the overstrike character.

   End of Line

      The end of line convention is the Telnet end of line convention
      which is the sequence <CR><LF>. It is recommended that use of <CR>
      and <LF> be avoided in other than the end of line context.

                                                   Standard File Formats
                                                        Standard Formats



Standard Formats

   Format 1 [Basic Document]

      This format is designed to be used for documents to be printed on
      line printers, which normally have 66 lines to a physical page,
      but often have forced top and bottom margins of 3 lines each.

         Active Format Effectors
            <FF>, <CR>, <LF>.
         Page Length
            60 lines.
         Page Width
            72 Characters.
         Overstriking
            By Line.

   Format 2 [Terminal]

      This format is designed to be used with hard copy terminals, which
      in the normal case have 66 lines to a physical page. It is
      expected that there are no top or bottom margins enforced by the
      terminal or its local system, thus any margins around the physical
      page break must come from the file.

         Active Format Effectors
            <FF>, <CR>, <LF>, <HT>, <VT>, <BS>.
         Page Length
            66 lines.
         Page Width
            72 Characters.
         Overstriking
            By Character.

                                                   Standard File Formats
                                                        Standard Formats



   Format 3 [Line Printer]

      This format is designed to be used with full width (11 by 14 inch
      paper) line printer output.

         Active Format Effectors
            <FF>, <CR>, <LF>.
         Page Length
            60 lines.
         Page Width
            132 Characters.
         Overstriking
            None.

   Format 4 [Card Image]

      This format is designed to be used for simulated card input. The
      page width is 80 characters, each card image is followed by
      <CR><LF>, thus each card is represented by between 2 and 82
      characters in the file. Note that the trailing spaces of a card
      image need not be present in the file, and that the early
      occurence of the <CR><LF> sequence indicates that the remainder of
      the card image is to contain space characters.

         Active Format Effectors
            <CR>, <LF>.
         Page Length
            Infinite.
         Page Width
            80 Characters.
         Overstriking
            None.

                                                   Standard File Formats
                                                        Standard Formats



   Format 5 [Center Document]

      This format is intended for use with documents to be printed  on
      line printers which normally have 66 lines to the physical page
      but enforce top and bottom margins of 3 lines each. The text is
      expected to be centered on the paper. If the horizontal printing
      density is 10 characters per inch and the paper is 8 and 1/2
      inches wide then there will be a one inch margin on each side.

         Active Format Effectors
            <FF>, <CR>, <LF>.
         Page Length
            60 Lines.
         Page Width
            65 Characters.
         Overstriking
            By Line.

   Format 6 [Bound Document]

      This format is intended for use with documents to be printed  on
      line printers which normally have 66 lines to the physical page
      but enforce top and bottom margins of 3 lines each. If the
      horizontal printing density is 10 characters per inch and the
      paper is 8 and 1/2 inches wide then the text should be positioned
      such that there is a 1 and 1/2 inch left margin and a one inch
      right margin.

         Active Format Effectors
            <FF>, <CR>, <LF>.
         Page Length
            60 Lines.
         Page Width
            60 Characters.
         Overstriking
            By Line.

                                                   Standard File Formats
                                              Implementation Suggestions



Implementation Suggestions

   Overflow

      Overflow can result from two causes, first if the physical page is
      smaller than the logical page, and second if the  actual text in
      the file violates the standard under which it is being processed.

      In either case the following suggestions are made to implementors
      of programs which process files in these formats.

      Length

         If more lines are processed than fit within the minimum of the
         physical page and the logical page length since the last <FF>,
         then the <FF> action should be forced.

      Width

         If more character positions are processed than fit on the
         minimum of the physical page width and the logical page width
         since the last <CR>, then characters are discarded up to the
         next <CR>.

         or

         If more character positions are processed than fit on the
         minimum of the physical page width and the logical page width
         since the last <CR>, then the <CR> and <LF> actions should be
         forced.

References

   A. McKenzie "TELNET Protocol Specification," Aug-73, NIC 18639.

   "USA Standard Code for Information Interchange," United States of
   America Standards Institute, 1968, NIC 11246.

AI ELI5

On this page
PROBLEMDifferent computer systems use different file formats, making it difficult to exchange documents across systems and networks.
MECHANISMThe RFC defines six standard document formats, each with a specified character set (ASCII), page dimensions (in lines and characters), and format control procedures (form feeds, line feeds, tabs), allowing authors to advertise files in a standard format.
WHY IT MATTERSDocuments prepared in a standard format can be transferred and printed on different systems with predictable results.

§1The Problem of Document Portability

RFC 678 addresses the problem of sharing online documents across the diverse computers and networks of the 1970s. When one system prepares a document file and another system tries to print or display it, differences in how the two systems handle files—character sets, line lengths, page breaks, spacing—create readability and printing problems.

The RFC proposes that instead of trying to convert files between many different local formats, the network community should adopt a set of standard formats. An author who prepares a document in one of these standard formats can advertise the format name, and users can retrieve and print the file with confidence in how it will appear.

Different kinds of computers write and print files in different ways, which makes sharing documents hard. This note suggests standard ways of writing that everyone can handle.

§2The Six Standard Formats

The RFC defines six formats, each suited to different printing environments. Format 1 (Basic Document) uses 60-line pages, 72 characters wide, with form feeds and line feeds, for line printers that enforce 3-line margins. Format 2 (Terminal) supports 66-line pages and hard-copy terminals with backspace and other format controls. Format 3 (Line Printer) fits full-width 132-character line printer paper. Format 4 (Card Image) simulates punched-card input with 80 characters per card. Format 5 (Center Document) formats 60 lines for printers with margins, centered on the page. Format 6 (Bound Document) similarly formats 60 lines but with asymmetric margins to leave room for binding.

All formats use the Network Virtual Terminal (NVT) ASCII code character set with the high order bit zero, ensuring compatibility across systems.

The six formats describe different page sizes and margins for different kinds of printers: line printers, terminals, card readers, and devices with margins for binding.

§3Format Controls and Page Geometry

Each format specifies its active format effectors—the ASCII control codes that the printer will obey. These include Form Feed (moves to the next logical page), Carriage Return (moves to the left edge), Line Feed (moves to the next line), Horizontal Tab (moves to the next tab stop), and Back Space (moves one character left). Not all formats use all effectors.

A logical page defines the usable area in lines and characters, independent of the physical printing device. For example, Format 1 uses a logical page of 60 lines by 72 characters, even though the physical paper might be 66 lines tall with 3-line margins.

Each format says which control codes the printer understands, and how many lines and characters fit on each page.

§4Implementation and Overflow Handling

The RFC suggests that implementors of file-processing programs create converters between their system's local format and these standard formats. When processing a standard-format file, if the text overflows the logical page, implementations should handle the situation in one of two ways: force a form feed (new page) when too many lines are received, or discard characters that exceed the line width, then move to the next line.

The use of horizontal tabs and vertical tabs is not recommended in standard document files, since different systems handle them inconsistently, potentially defeating the goal of portability.

Programs reading these files should be ready to skip lines if they are too long, or to start a new page if too many lines arrive at once.