System.ArgumentException: Unrecognized character encoding
DiscUtils 0.11.0.2 Windows 10 64-bit .NET Framework 4.5.2
I only get this exception sometimes, and without any code or data changes.
CDBuilder builder = new CDBuilder
{
UseJoliet = true,
VolumeIdentifier = "XXXXXXXXXX"
};
foreach (KeyValuePair<string, string> file in files)
{
string sourceFilePath = file.Key;
string destinationRelativeFilePath = file.Value;
builder.AddFile(destinationRelativeFilePath, sourceFilePath);
}
builder.Build(isoFilePath);
System.ArgumentException: Unrecognized character encoding
at DiscUtils.Iso9660.IsoUtilities.EncodingToBytes(Encoding enc, Byte[] data, Int32 offset) in c:\root\codeplex\discutils\src\Iso9660\IsoUtilities.cs:line 422
at DiscUtils.Iso9660.SupplementaryVolumeDescriptor.WriteTo(Byte[] buffer, Int32 offset) in c:\root\codeplex\discutils\src\Iso9660\SupplementaryVolumeDescriptor.cs:line 54
at DiscUtils.Iso9660.SupplementaryVolumeDescriptorRegion.GetBlockData() in c:\root\codeplex\discutils\src\Iso9660\SupplementaryVolumeDescriptorRegion.cs:line 38
at DiscUtils.Iso9660.VolumeDescriptorDiskRegion.PrepareForRead() in c:\root\codeplex\discutils\src\Iso9660\VolumeDescriptorRegion.cs:line 38
at DiscUtils.BuiltStream.Read(Byte[] buffer, Int32 offset, Int32 count) in c:\root\codeplex\discutils\src\BuiltStream.cs:line 117
at DiscUtils.StreamBuilder.Build(Stream output) in c:\root\codeplex\discutils\src\StreamBuilder.cs:line 53
at DiscUtils.StreamBuilder.Build(String outputFile) in c:\root\codeplex\discutils\src\StreamBuilder.cs:line 70
Any ideas?
Thank you.
Seems like #77 - try the workaround there.
Although that is primarily for .NET Core, ... if it works, somethings wrong with .NET Framework (or you're secretly running Core :P) - if it doesn't, we need to figure out which Codepage it's trying to load.
I think the unsupported encoding type should be included in the exception message. https://github.com/DiscUtils/DiscUtils/blob/b89645ca99eedaf926fd2247c746c4528243d368/Library/DiscUtils.Iso9660/IsoUtilities.cs#L426
I'm not sure how the encoding could be anything other than BigEndianUnicode or ASCII.