BUG? with CLI and GO templates

I question mark the BUG, as more a PSA and/or me not configuring Powershell correctly...

After a while of scratching my head wondering why a GO template was not working with the --transformstr parameter, but fine when using a file (--transform) parameter, with same Go template I discovered that using Powershell 5.1 (Windows 10 default) uses UTF-16 LE BOM encoding.

Creating a string variable in Powershell for the template failed every time, but NO error message from the GC command. It returned the powershell GO template variable name.

I saved GO template variable to a file, compared to existing file I had, and then discovered the different encoding format (thanks to N++ telling me on compare command).

If you do same script in Powershell 7 (installed to test as defaults to UTF8) the --transformstr parameter with a powershell variable works!

The short version request:
Can GC CLI be updated to support the string encoding, so works with 5.x powershell (The most common installed on windows 10/11) PCs or at least something in the CLI documentation, around the GO detail collateral on this gotcha. May save some other poor soul pulling hair out.

There may be a way to configure Powershell around this, I need to look into that.

Powershell 7 works fine as mentioned, I may just transition to that anyway!

Simon

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.