title: How can I encode xml files to xfdl (base64-gzip)?
body: <p>Before reading anything else, please take time to read the <a href="https://stackoverflow.com/questions/1615/how-can-i-modify-xfdl-files-update-1">original thread</a>.</p>
  
  <p>Overview:  a .xfdl file is a gzipped .xml file which has then been encoded in base64.  I wish to de-encode the .xfdl into xml which I can then modify and then re-encode back into a .xfdl file.</p>
  
  <blockquote>
    <p>xfdl > xml.gz > xml > xml.gz > xfdl</p>
  </blockquote>
  
  <p>I have been able to take a .xfdl file and de-encode it from base64 using uudeview:</p>
  
  <pre><code>uudeview -i yourform.xfdl
  </code></pre>
  
  <p>Then decommpressed it using gunzip</p>
  
  <pre><code>gunzip -S "" &lt; UNKNOWN.001 &gt; yourform-unpacked.xml
  </code></pre>
  
  <p>The xml produced is 100% readable and looks wonderful.  Without modifying the xml then, i should be able to re-compress it using gzip:</p>
  
  <pre><code>gzip yourform-unpacked.xml
  </code></pre>
  
  <p>Then re-encoded in base-64:</p>
  
  <pre><code>base64 -e yourform-unpacked.xml.gz yourform_reencoded.xfdl
  </code></pre>
  
  <p>If my thinking is correct, the original file and the re-encoded file should be equal.  If I put yourform.xfdl and yourform_reencoded.xfdl into beyond compare, however, they do not match up.  Also, the original file can be viewed in an http://www.grants.gov/help/download_software.jsp#pureedge">.xfdl viewer.  The viewer says that the re-encoded xfdl is unreadable.  </p>
  
  <p>I have also tried uuenview to re-encode in base64, it also produces the same results. Any help would be appreciated.</p>