[
  {
    "Id": "817789",
    "ThreadId": "350655",
    "Html": "<p>I'm having an issue similar to this thread:&nbsp;<a href=\"http://dotnetzip.codeplex.com/discussions/209184\">http://dotnetzip.codeplex.com/discussions/209184</a></p>\n<p>I am using ZipOutputStream to create an epub file, because I'm assembling it from various in-memory and on-disk sources. Works well, and it does open in <em>some</em> readers. However, when I validate it with <strong>epubcheck</strong>, I get this message:</p>\n<p>&nbsp;</p>\n<pre>ERROR: filename.epub: Extra field length for first filename must be 0, but was 20 !</pre>\n<p>&nbsp;</p>\n<p>I create a new ZipEntry with path \"mimetype\", set IsUnicodeText to false, set ExternalFileAttributes to 0, set Flags to 0, set ExtraData to a blank array or null, set CompressionMethod to Stored and write \"application/epub+zip\" to the stream.</p>\n<p>When I look at the file with a hex editor, I do see 20 extra bytes after \"mimetype\".</p>\n<p>&nbsp;</p>\n<pre>01 00 10 00 2a 00 00 00 00 00 00 00 2a 00 00 00 00 00 00 00</pre>\n<p>&nbsp;</p>\n<p>Where are those bytes coming from? How do I get rid of them? I don't know enough about the ZIP format or this library to attempt to figure out what they actually are, I assumed they were extra fields as in the linked thread.</p>\n<p>&nbsp;</p>\n<p>(My code is in F# which may look a bit strange to you, but here's the sample...)</p>\n<p>&nbsp;</p>\n<pre>  use outStream = IO.WriteStream options.OutputPath\n  use zip = new Zip.ZipOutputStream(outStream)\n\n  let AddLiteralHelper (compress:bool) (path:string) (content:string) =\n    let entry = new Zip.ZipEntry(path)\n    entry.IsUnicodeText &lt;- false\n    entry.ExternalFileAttributes &lt;- 0\n    entry.Flags &lt;- 0\n    entry.ExtraData &lt;- Array.empty\n    if not compress then\n      entry.CompressionMethod &lt;- Zip.CompressionMethod.Stored\n    zip.PutNextEntry(entry)\n    let stuff = IO.StringStream content\n    stuff.CopyTo zip\n\n  // Add a file with `content` at `path`\n  let AddLiteral = AddLiteralHelper true\n  let AddLiteralUncompressed = AddLiteralHelper false\n\n\n  // Configure the epub metadata\n\n  AddLiteralUncompressed \"mimetype\" \"application/epub+zip\"\n\n  AddLiteral \"META-INF/container.xml\"\n    @\"some xml goes here... snipped for brevity\"\n</pre>\n<p>&nbsp;</p>",
    "PostedDate": "2012-03-30T08:34:26.93-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "820055",
    "ThreadId": "350655",
    "Html": "<p>For anyone who Googles this way or sees this post later, I just switched zip libraries to DotNetZip, which supports the setting</p>\r\n<pre>&nbsp;&nbsp;ZipFile.EmitTimesInWindowsFormatWhenSaving\r\n</pre>\r\n<p>Which, when turned off, works fine for EPUB.</p>",
    "PostedDate": "2012-04-04T13:51:50.303-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]