No way to set StringCodec on ZipInputStream & ZipOutputStream
zhuxb711 opened this issue · 2 comments
zhuxb711 commented
[Obsolete("Use ZipFile/Zip*Stream StringCodec instead")]
I got this from the latest version. But ZipInputStream & ZipOutputStream do not provide any StingCodec property and the only one which might be useful constructor is internal
Expected behavior
Should allow us to set the StringCodec if ZipStrings.CodePage is obsolete
Actual behavior
No way except the obsolete way to set the StringCodec
Version of SharpZipLib
1.4.0
Obtained from (only keep the relevant lines)
- Package installed using NuGet
piksel commented
Yes, you are right, not sure how that happened. There should be getters and setters to access the internal _stringCodec
, and perhaps the constructor should be public as well.
zhuxb711 commented
Use reflection to work around this issue in case someone needs it.
StringCodec Codec = new StringCodec
{
ForceZipLegacyEncoding = true,
CodePage = EncodingSetting.CodePage
};
using ZipOutputStream OutputStream = (ZipOutputStream)typeof(ZipOutputStream).GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, Type.DefaultBinder, new Type[] { typeof(Stream), typeof(StringCodec) });