0

I am writing. text to a file, the test is with diacritic.

Such as Australia, Německo, Pepř, etc,however once I read the text the char with diacritic are broken Austr?lie. I have tried to use Encoding.ASCII instead on new byte but still.

This is how I create file

public static FileStream CreateFile(string fileName)
        {
           var wholePath =  PathService.ReturnBinLocation(fileName);

           if (File.Exists(wholePath))
           {
               File.Delete(wholePath);
           }

           return File.Create(wholePath);
        }

And this is how I write in my data

 private static async Task CreateFileFroApiData(string strContent )
       {
          await using var fs = FileService.CreateFile("filename.txt");
          //var content =  Encoding.ASCII.GetBytes(strContent); 
          var content  = new byte[strContent.Length];
          fs.Seek(0, System.IO.SeekOrigin.Begin);
          await fs.WriteAsync(content.AsMemory(0, strContent.Length));
       }
Nodessa
  • 79
  • 6

0 Answers0