Written by

Question Steven Coker · Jul 10, 2023

Log output is adding extra spaces

Hello, I am trying to write a script that will output a .log file. When I get PowerShell to parse the file with Get-Content, I find that there are extra spaces in the parsing. How can I edit my Intersystems script to output a logfile encoded differently? I think its outputting in unicode by default.

Comments

Steven Coker · Jul 10, 2023

Nevermind! I found that in powershell if I use the snippet below, PS will intake the file as the listed encoding. In my case, CTerm was outputting UTF8. I brought that file into PS using Unicode, and it removed the extra spaces. 

(Get-Content -Path <filepath.txt> -Encoding Unicode)
0
Alex Woodhead  Jul 10, 2023 to Steven Coker

If someone else stumbles across question in the future:

Some encoding values supported are:

  • Unicode
  • Byte
  • BigEndianUnicode
  • UTF8
  • UTF7
  • UTF32
  • Ascii
  • BigEndianUTF32
0