I wrote a script that works perfectly in both PS7 and PS5, except it writes the log entries with null spaces after every character in PS5. I've never seen this before and can't find much about it online.
code that creates a log entry:
Write-Output "$logDate $thisScriptName v$thisScriptVersion - Script Started" | Out-File $logHistory -Append
The log file (open in VSCode): null character insertion
I can't copy and paste the text from VSCode (hence the snip) as it just pastes a null (0) value into the text area.
The correctly formatted text is added with ps7.
EDIT: As per comments, this was fixed by adding -Encoding ascii (or utf8) to the Out-File. Using Add-Content -Value $string -Path $file also worked for me.