15

I use SharpZipLib to compress file and user got this error:

1 is not a supported code page

I found here that problem is in regional settings and solution is in

"replace the line of code that fetches the code page from the Thread's OEMCodePage and instead hardcode the suitable value."

But I didn't find any code example to solve this problem.

Kirill
  • 429
  • 1
  • 6
  • 18

1 Answers1

19

Line below hardcodes code page to avoid getting it from system regional settings:

ICSharpCode.SharpZipLib.Zip.ZipConstants.DefaultCodePage = 437;
5andi5
  • 234
  • 4
  • 10
  • 5
    I think the asker would also benefit from an explanation so they don't repeat the mistake. – Xantium Dec 27 '17 at 19:27
  • Fixed my bug with the Visual Ribbon Editor for CRM. Thanks – user3772108 Jun 14 '18 at 06:50
  • 1
    Codepage [850](https://en.wikipedia.org/wiki/Code_page_850) may be a better choice in some cases. According to the SharpZipLib comments, unicode codepages like [65001](https://en.wikipedia.org/wiki/UTF-8) (UTF-8) are not a good idea due to compatability issues. – Louis Somers Apr 08 '19 at 07:10
  • 1
    This is what's so great about stackoverflow, you have a really weird error happening on just one computer and someone already found the solution. – Timbo Feb 16 '21 at 08:51