Silverlight and 'IBM437' is not a supported encoding name

Oct 24, 2011 at 8:00 AM

I wanted a compress/decompress for silverlight so I pulled the
Ionic.Zip Silverlight v1.9 packed Sat-08-06-2011-215945.06.

But as soon as I do

Dim zip1 As ZipFile = New ZipFile()

I get and exception 'IBM437' is not a supported encoding name.

Any ideas.






Dec 6, 2011 at 8:23 PM
Edited Dec 6, 2011 at 8:57 PM

Did you solve this problem?  I am trying to use DotNetZip with Silverlight 4 and I'm running into the same exception.

Specifically, my call stack is as follows:

mscorlib.dll!System.Globalization.EncodingTable.internalGetCodePageFromName(string name) + 0x135 bytes

mscorlib.dll!System.Globalization.EncodingTable.GetCodePageFromName(string name) + 0x69 bytes

mscorlib.dll!System.Text.Encoding.GetEncoding(string name) + 0x8 bytes

Ionic.Zip!Ionic.Zip.ZipInputStream._Init(System.IO.Stream stream, bool leaveOpen, string name) + 0xb5 bytes

Ionic.Zip!Ionic.Zip.ZipInputStream.ZipInputStream(System.IO.Stream stream, bool leaveOpen) + 0x38 bytes

Ionic.Zip!Ionic.Zip.ZipInputStream.ZipInputStream(System.IO.Stream stream) + 0x28 bytes

I made sure I encoded the stream using UTF8 since I noticed some discussions suggesting that IBM437 is not supported in Silverlight.  Same result.

Dec 6, 2011 at 9:37 PM

Yeah, looking at the source code, line 347 of ZipInputStream.cs is calling System.Text.Encoding.GetEncoding("IBM437"); which will throw an exception in Silverlight (see

Can we get this fixed?  Maybe throw an exception handler around the call and set _provisionalAlternateEncoding to something else?

Unless I'm missing something, I can't use DotNetZip to do what I want to do in Silverlight with this error.

Dec 7, 2011 at 6:29 AM

Well I was in a rush so used a different package.


Imports ICSharpCode.SharpZipLib.GZip

Code was something like :

Dim inputData(message.Length) As Byte
inputData = UTF8Encoding.UTF8.GetBytes(message)

Dim inputUnZipStream As GZipInputStream = New GZipInputStream(New MemoryStream(inputData))

' Need a first pass unzip to determine how big the unzipped data is.
' Unzipp in chunks
Dim tempBuffer(1000) As Byte
Dim uncompressedSize As Integer = 0
Dim chunk As Integer = 0
    chunk = inputUnZipStream.Read(tempBuffer, 0, 1000)
    uncompressedSize = uncompressedSize + chunk
Loop Until chunk <= 0

'Start the unzip again but this time we know how much we will get.
inputUnZipStream = New GZipInputStream(New MemoryStream(inputData))
Dim inputXmlBuffer(uncompressedSize) As Byte
Dim inputXmlSize As Integer = inputUnZipStream.Read(inputXmlBuffer, 0, uncompressedSize)

'inputXml is the xml load string from the server
Dim inputXml1 As String = UTF8Encoding.UTF8.GetString(inputXmlBuffer, 0, inputXmlBuffer.Length)

Dec 7, 2011 at 8:26 AM
Edited Dec 7, 2011 at 8:35 AM

There is a potential fix posted against this work item here:

How do you initiate pull requests on codeplex? I would be happy to contribute with some Silverlight unit tests if they are needed.

Dec 7, 2011 at 8:53 PM

Ah, excellent.  The proposed solution looks good.  I was able to test my code using a version I modified myself, and it works like a charm (in my one extremely specific test case).  Thanks!