title: Implementing "TYPE A" in an FTP server
body: <p>I'm writing an FTP server (in Qt/C++), and right now I with "200 Ok" to "TYPE A", but I really treat it the same as "TYPE I" - files are sent as-is.</p>
  
  <p>How should I go about properly implementing TYPE A? Would opening the files in text mode instead of binary mode be enough?</p>
  
  <p>Also, I assume that the SIZE method should be more complex than returning the file's size on disk, it should read it and perform the text substitutions, and return the size that way?</p>
  
  <p><strong>Edit:</strong> In response to a comment, here's the relevant excerpt from <a href="http://www.ietf.org/rfc/rfc959.txt" rel="nofollow">the RFC959 spec</a>:</p>
  
  <blockquote>
  <pre><code>     3.1.1.1.  ASCII TYPE
  
          This is the default type and must be accepted by all FTP
          implementations.  It is intended primarily for the transfer
          of text files, except when both hosts would find the EBCDIC
          type more convenient.
  
          The sender converts the data from an internal character
          representation to the standard 8-bit NVT-ASCII
          representation (see the Telnet specification).  The receiver
          will convert the data from the standard form to his own
          internal form.
  
          In accordance with the NVT standard, the &lt;CRLF&gt; sequence
          should be used where necessary to denote the end of a line
          of text.  (See the discussion of file structure at the end
          of the Section on Data Representation and Storage.)
  
          Using the standard NVT-ASCII representation means that data
          must be interpreted as 8-bit bytes.
  
          The Format parameter for ASCII and EBCDIC types is discussed
          below.
  </code></pre>
  </blockquote>