While read the zip package files name (For Ex: TestDocumentááá), which has diacritic character,
It returns symbol character like below.
Actual Result: TestDocument���.docx
Expected Result: TestDocumentááá.docx
private async void OnInputFileChange(InputFileChangeEventArgs e)
{
foreach (IBrowserFile file in e.GetMultipleFiles())
{
await using Stream stream = file.OpenReadStream((int)file.Size);
MemoryStream memoryStream = new MemoryStream((int)file.Size);
await stream.CopyToAsync(memoryStream);
memoryStream.Position = 0;
CancellationTokenSource cancellation = new CancellationTokenSource();
byte[] buffer = new byte[file.Size];
string UniqueFileName = Path.GetRandomFileName() + ".bin";
string tmpfile = Path.GetTempFileName();
tmpfile = e.File.Name;
int bytesRead = 0;
while ((bytesRead = await memoryStream.ReadAsync(buffer, cancellation.Token)) != 0)
{
using MemoryStream tmpMemoryStream = new MemoryStream(buffer, 0, bytesRead);
using (var fs = new FileStream(tmpfile, FileMode.Append))
{
tmpMemoryStream.WriteTo(fs);
}
};
using ZipArchive zipArchive = ZipFile.OpenRead(tmpfile);
foreach (ZipArchiveEntry entry in zipArchive.Entries)
{
// Get file name as Symbolioc character
// entry.FullName ->> TestDocument���.docx
//byte[] bytes = Encoding.UTF8.GetBytes(entry.FullName);
//string text2 = Encoding.UTF8.GetString(bytes);
}
}
}