There is an array of bytes byte [] buffer, I read it into a string and convert to base64
string chunk = Convert.ToBase64String(buffer); After I transfer it to powershell script in C #, where I decode it back and write this line to the file
$DataDecoded = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String('Chunk')) Invoke-Command {$using:DataDecoded | Add-Content -Path C:\Test\Script1.ps1 -NoNewLine} -ComputerName " + configuration.Ip + @" -Credential $Cred As a result of such cycles there may be several while copying the file in pieces, and the output is a file where at the very beginning of the first line there is a question mark '?' Nowhere else, if I change the encoding in a string to ASCII, then there are three question marks '???'
I understand this is a BOM. I certainly need a file without these question marks ... is it possible to remove it somehow? I have already tried all the options with these encodings