[
  {
    "Id": "615122",
    "ThreadId": "258217",
    "Html": "\r\n<p>I have a .zip file from client which contains certain Text files.</p>\r\n<p>Now I am validating that they are Text file via property</p>\r\n<p>&nbsp;</p>\r\n<p></p>\r\n<div style=\"color:black; background-color:white\">\r\n<pre><span style=\"color:blue\">foreach</span> (ZipEntry ze <span style=\"color:blue\">in</span> objSourceZip)\r\n                {\r\n                            <span style=\"color:blue\">if</span> (!ze.IsText)\r\n                            {\r\n                                IsValid = <span style=\"color:blue\">false</span>;\r\n                            }\r\n                            <span style=\"color:blue\">break</span>;\r\n                  }\r\n\r\n</pre>\r\n</div>\r\n<p></p>\r\n<p>Now Although files in this zip are Text files but i am getting this property false.After unzipping and then again making zip file on my system it certainly shows that isText property true?</p>\r\n<p>Why is this behavior occuring?</p>\r\n",
    "PostedDate": "2011-05-19T03:45:15.213-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "615418",
    "ThreadId": "258217",
    "Html": "<p>The IsText property reflects the metadata stored in the zipfile itself.</p>\n<p>There are lots of zip tools out there, and some of them \"respect\" that metadata field, and some of them don't.&nbsp; Unfortunately, even when an application tries to do \"the right thing\", it's not always clear what \"the right thing\" is.&nbsp; &nbsp;Regardless of all that, DotNetZip is just telling you what's stored in there.</p>\n<p>When DotNetZip is used to <em>create </em>a zipfile, it attempts to respect that field.&nbsp; That's why you see IsText being set differently when DNZ is used to create the zip, versus some other tool.</p>\n<p>I would caution you to be careful about relying on the IsText property.&nbsp; It's sort of wrongheaded, in my opinion.&nbsp; Or maybe it's outlived its usefulness.&nbsp; There's no firm definition of just what it means to be \"a text file\", not even in the zip spec. Twenty years ago, text was ASCII,&nbsp;each&nbsp;byte was less than 127.&nbsp; So I guess they didn't need a formal definition.&nbsp; IsText meant, all bytes are less than 127.&nbsp;&nbsp; Now, it is not the case that all text files have all bytes less than 127.&nbsp; a UTF-8 file has bytes&nbsp;that are above 0x7f.&nbsp;&nbsp; The zip spec predates all that unicode stuff, and so it has nothing to say on the topic.&nbsp;</p>\n<p>So I would say, be careful relying on the IsText property.&nbsp; It's not clear that it has a firm meaning, across tools and libraries.</p>\n<p>These days, a more general way to decide just what&nbsp;kind of file you have, is to use the file type database stored in the operating system.&nbsp; This is the thing that says, a file with .jpg extension is a JPG image file, a file with a .xml extension is an XML document, a file with a .txt is a pure ASCII text document, and so on.&nbsp; Like maybe with ShGetFileInfo - you'd need to do a p/invoke for that.&nbsp; It ends up getting complicated. A better idea might be to just use a heuristic.&nbsp; If there are 4 extensions the files in your zip archive common have, (for example, txt exe doc and ini), then you could heuristically determine the filetype based on comparing it to those known types.</p>\n<p>Good luck.</p>",
    "PostedDate": "2011-05-19T11:52:26.17-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "635814",
    "ThreadId": "258217",
    "Html": "<p>It's Bad.I have relied on this property.Ionic zip either shouldn't have this property or should have clearly communicated about it as it is unreliable.</p>",
    "PostedDate": "2011-06-30T23:34:13.883-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "637238",
    "ThreadId": "258217",
    "Html": "<p>The documentation indicates that it may be irrelevant:</p>\r\n<p><a href=\"http://cheeso.members.winisp.net/DotNetZipHelp/html/a3a7e1eb-eb08-37a8-f1f2-d66645062a32.htm\">http://cheeso.members.winisp.net/DotNetZipHelp/html/a3a7e1eb-eb08-37a8-f1f2-d66645062a32.htm</a></p>\r\n<p>I agree that the doc could more clearly state that the bit is as set by the writing application, and may not have any particular real meaning.</p>",
    "PostedDate": "2011-07-04T18:47:50.73-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "637239",
    "ThreadId": "258217",
    "Html": "This discussion has been copied to a work item. Click <a href=\"http://dotnetzip.codeplex.com/workitem/13886\">here</a> to go to the work item and continue the discussion.",
    "PostedDate": "2011-07-04T18:48:57.84-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]