Legacy Dev Forum Posts

 View Only

Sign Up

BUG? with CLI and GO templates

  • 1.  BUG? with CLI and GO templates

    Posted 06-05-2025 18:27

    SimonBrown | 2023-08-11 15:57:58 UTC | #1

    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


    system | 2023-09-10 15:58:57 UTC | #2

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


    This post was migrated from the old Developer Forum.

    ref: 21486