I am using mono and monobjc to develop an application to run on Mac OS X 10.6. I am adding some files to a zip file using ICSharpCode.SharpZip. The code is as -
var ms = new MemoryStream();
var zipStream = new ZipOutputStream(ms);
zipStream.PutNextEntry(new ZipEntry(Path.GetFileName(file))
{DateTime = File.GetCreationTime(file),
Size = new FileInfo(file).Length});
Sometimes, not always, The PutNewEntry code throws the following exception -
System.NotSupportedException: CodePage 437 not supported at System.Text.Encoding.GetEncoding (Int32 codepage) [0x00000] in :0 at ICSharpCode.SharpZipLib.Zip.ZipConstants.ConvertToArray (System.String str) [0x00000] in :0 at ICSharpCode.SharpZipLib.Zip.ZipConstants.ConvertToArray (Int32 flags, System.String str) [0x00000] in :0 at ICSharpCode.SharpZipLib.Zip.ZipOutputStream.PutNextEntry (ICSharpCode.SharpZipLib.Zip.ZipEntry entry) [0x00000] in :0 at (wrapper remoting-invoke-with-check) ICSharpCode.SharpZipLib.Zip.ZipOutputStream:PutNextEntry (ICSharpCode.SharpZipLib.Zip.ZipEntry)
I have the following two questions -
- What is the causing the above exception.
- It looks like ICSharp may not be the best option. What are the better alternatives?.