Extra Spaces in Log Files
techcubs opened this issue · 1 comments
recently, when i try and add a og file, i get extra spaces in it. Any ideas why this could be happening?
the Powershell script has this line:
Write-Colour "##################", " Create Contributor and Reader Security Groups ", "################## " -Color Cyan, Yellow, Cyan -LogFile $Logfile
the output in visual studio shows:
################## Create Contributor and Reader Security Groups ##################
and the log file has this in it:
[ 2 0 2 3 - 0 4 - 2 0 1 6 : 2 0 : 0 2 ] # # # # # # # # # # # # # # # # # # C r e a t e C o n t r i b u t o r a n d R e a d e r S e c u r i t y G r o u p s # # # # # # # # # # # # # # # # # #
Hi, so I can't reproduce it myself by @jborean93 on Discord said this may be because of software that is not capable of reading unicode/utf-16 properly and it opens it wrong:
Most likely using pwsh 5.1 where the default encoding is Unicode/UTF-16-LE where for ASCII chars are 2 bytes with the 2nd being 0. This usually appears as a space if not opened with the right encoding
If you have an editor that respects the BOM and reads it as utf-16 it will be fine
But if an editor tries to read a utf-16 encoded file using something like ASCII or even utf-8 you’ll get the results they see
Your problem may also be related to already existing file that you are appending too and the encoding on the existing file is different then the one with which you are appending (again tip from @jborean93)