# Syside solver and use of jq or Powershell formatting does not match web examples

**URL:** <https://forum.sensmetry.com/t/syside-solver-and-use-of-jq-or-powershell-formatting-does-not-match-web-examples/582>\
**Category:** Bug Reports\
**Tags:** cli\
**Created:** [September 23, 2026, 10:12pm UTC](https://forum.sensmetry.com/t/syside-solver-and-use-of-jq-or-powershell-formatting-does-not-match-web-examples/582 "2026-09-23T22:12:43Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Richard\_Wallace](https://yyz2.discourse-cdn.com/flex008/user_avatar/forum.sensmetry.com/richard_wallace/32/307_2.png) [@Richard\_Wallace](https://forum.sensmetry.com/u/Richard_Wallace)\
**Post date:** [September 23, 2026, 10:12pm UTC](https://forum.sensmetry.com/t/syside-solver-and-use-of-jq-or-powershell-formatting-does-not-match-web-examples/582/1 "2026-09-23T22:12:43Z")

</div>

Hi,

Issues with the solver and jq noted. Please let me know if you can duplicate or if I’ve done something wrong. Thanks.

Not being a wizard with jq, but only following the webpage examples at [Reading the solver’s output — Syside](https://docs.sensmetry.com/automator/solver/output/) I get the following output for CMD, PS, and Bash shells. I ran all three because there have been inconsistencies between them for the solver command line previously.

The results are:

```auto
+====================+
| With Windows 10 PS |
+====================+

> $PSVersionTable.PSVersion

Major Minor Patch PreReleaseLabel BuildLabel
----- ----- ----- --------------- ----------
7 6 6

PS> syside solver check -i package_pump.sysml
{
  "result": {
    "subject": "Pump",
    "expression": "assertions[2]",
    "determination": "determined",
    "outcome": {
      "shape": "assertions",
      "assertions": [
        { "name": "Pump::flowOk", "status": "satisfied", "counterexample": null },
        {
          "name": "Pump::pressureOk",
          "status": "violated",
          "counterexample": {
            "values": [
              ["Pump::pump::pressure", "11"]
            ]
          }
        }
      ]
    },
    "causes": []
  },
  "warnings": [],
  "exit_code": 1
}

+=================================+
| Using native PS commands and jq |
+=================================+

PS> syside solver check -i package_pump.sysml | ConvertFrom-Json |
>> ForEach-Object { $_.result.outcome.assertions } |
>> Format-Table name, status
ConvertFrom-Json: Conversion from JSON failed with error: Unexpected character encountered while parsing value: ?. Path '', line 1, position 1.

+==============+
| and using jq |
+==============+
PS> jq --version
jq-1.8.2

PS> syside solver check -i package_Pump.sysml | jq -r '.result.outcome.assertions[] | "\(.status)\t\(.name)"'
jq: parse error: Invalid numeric literal at line 1, column 3

+==============================+
| With Windows 10 CMD using jq |
+==============================+

CMD> syside solver check -i package_Pump.sysml | jq -r '.result.outcome.assertions[] | "\(.status)\t\(.name)"'
The system cannot find the path specified.

+===============+
| With Git bash |
+===============+
$ echo $BASH_VERSION
5.2.37(1)-release

$ syside solver check -i package_Pump.sysml | jq -r '.result.outcome.assertions[] | "\(.status)\t\(.name)"'
jq: parse error: Invalid numeric literal at line 1, column 3

```

V/r,

@Richard_Wallace

---

<div class="post-metadata">

**Author:** ![Adam\_Layne](https://yyz2.discourse-cdn.com/flex008/user_avatar/forum.sensmetry.com/adam_layne/32/230_2.png) [@Adam\_Layne](https://forum.sensmetry.com/u/Adam_Layne)\
**Post date:** [October 1, 2026, 12:55am UTC](https://forum.sensmetry.com/t/syside-solver-and-use-of-jq-or-powershell-formatting-does-not-match-web-examples/582/2 "2026-10-01T00:55:37Z")

</div>

You haven’t done anything wrong. On Windows, when `syside`’s output goes into a pipe or a file, it comes out as UTF-16 instead of UTF-8. jq and `ConvertFrom-Json` both expect UTF-8, so they choke on the first two bytes. That’s the `?` in the PowerShell error and the “column 3” in the jq one. I’ve raised it internally.

Until that’s fixed, setting `PYTHONUTF8=1` before running the solver makes the output plain UTF-8, and the examples from the docs then work as written.

PowerShell:

```powershell
$env:PYTHONUTF8 = 1
syside solver check -i package_pump.sysml | jq -r '.result.outcome.assertions[] | "\(.status)\t\(.name)"'

```

CMD has a second, separate problem: it doesn’t treat single quotes as quotes, so the `|` inside the jq filter gets read as another pipe. That’s where “The system cannot find the path specified” comes from. The simplest way around it is to put the filter in a file, e.g. `summary.jq`:

```auto
.result.outcome.assertions[] | "\(.status)\t\(.name)"

```

and then:

```bat
set PYTHONUTF8=1
syside solver check -i package_pump.sysml | jq -r -f summary.jq

```

Thanks for running it in all three shells; that made this quick to pin down.

Adam Layne, PhD

---

<div class="post-metadata">

**Author:** ![Daumantas](https://yyz2.discourse-cdn.com/flex008/user_avatar/forum.sensmetry.com/daumantas/32/19_2.png) [@Daumantas](https://forum.sensmetry.com/u/Daumantas)\
**Post date:** [October 1, 2026, 6:54am UTC](https://forum.sensmetry.com/t/syside-solver-and-use-of-jq-or-powershell-formatting-does-not-match-web-examples/582/3 "2026-10-01T06:54:48Z")

</div>

> [@Adam\_Layne](#):
>
> Until that’s fixed, setting `PYTHONUTF8=1` before running the solver makes the output plain UTF-8, and the examples from the docs then work as written.

I have tried using UTF-8 as the default encoding on Windows but Powershell butchers anything non-ASCII during its _automatic_ conversion of text to UTF-16 (or more likely it converts any narrow and UTF-32 string to a wide string using the default code page), and I have not found a way to disable this behaviour. From my testing, neither changing the code page worked.

This is with forcing Python to output UTF-8 and piping the output, both to file and `echo`:

![image](https://canada1.discourse-cdn.com/flex008/uploads/syside/optimized/1X/da3397a85dbb16a164b7b9c813cf8744a9dcb757_2_690x62.png)

While redirecting UTF-8 output to a file with `cmd.exe` incorrectly sets UTF-16 file encoding anyway leading to garbage.

TLDR: there is no good way to use UTF-8 output with Python on Windows, there is nothing to fix. I am also not a fan of Windows being the only platform which mainly uses wide strings everywhere.

After further checking, this seems to be an issue with Python standard streams. Bypassing them and outputting unicode directly to C `stdout`/`stderr` works correctly even if the automatic widening conversion remains.

---

<div class="post-metadata">

**Author:** ![Richard\_Wallace](https://yyz2.discourse-cdn.com/flex008/user_avatar/forum.sensmetry.com/richard_wallace/32/307_2.png) [@Richard\_Wallace](https://forum.sensmetry.com/u/Richard_Wallace)\
**Post date:** [October 1, 2026, 5:55pm UTC](https://forum.sensmetry.com/t/syside-solver-and-use-of-jq-or-powershell-formatting-does-not-match-web-examples/582/4 "2026-10-01T17:55:02Z")

</div>

Thank you @Adam_Layne and @Daumantas for your analysis. 😀

The whole point of putting in this bug report is to say, “If you have an example on your web pages, make sure it works.” Any caveats, utilities, and environment settings should be mentioned on the web page. I don’t want to be a nitpicky user, but if you want people to use your products, make sure any examples on your public pages are correct. I know it’s difficult to anticipate all environments, so it’s best practice to state what the environment should support for the example to work correctly.🤨

As you support both Windows and Unix derivatives, you’ve signed up for at least a two-string testing discipline.

I’m more than happy to be a beta tester, as it lets me teach/consult better, since I’ll know the “gotchas” of using the Syside, Sysand, and CLI tools (and recommended utilities). 😉

So, to be useful, what I’ll do is “whack” away at this jq issue and write up my findings and post them back on this thread for your analysis.

V/r,

@Richard_Wallace

---

<div class="post-metadata">

**Author:** ![Richard\_Wallace](https://yyz2.discourse-cdn.com/flex008/user_avatar/forum.sensmetry.com/richard_wallace/32/307_2.png) [@Richard\_Wallace](https://forum.sensmetry.com/u/Richard_Wallace)\
**Post date:** [October 4, 2026, 8:21pm UTC](https://forum.sensmetry.com/t/syside-solver-and-use-of-jq-or-powershell-formatting-does-not-match-web-examples/582/5 "2026-10-04T20:21:25Z")

</div>

Howdy @Adam_layne, @Daumantas, and all the ships at sea! 😀

After some experimentation, I did get things to work correctly for CMD, PowerShell (v7), and Bash shells under Windows.

The solution is in two parts.

- Part 1: convert the syside solver UTF-16LE file to UTF-8
- Part 2: run with an input file to obviate the need for special shell treatment of jq formatting

Given the SysML v2 specification:

```auto
package Pump {
    private import ScalarValues::Integer;
    part pump[1] {
        attribute flowRate : Integer = 40;
        attribute pressure : Integer;
    }
    assert constraint flowOk { pump.flowRate <= 50 }
    assert constraint pressureOk { pump.pressure <= 10 }
}

```

And issuing the sysside solver command for all shells (CMD, PS(7), and Bash):

`> syside solver check -i pump.sysml > solver.out`

This results in a UTF-16LE encoded file `solver.out` due to the I/O “`>`” operator in all shells under Windows.

To convert the file for each shell, here are the tested steps. For those who want to pipe commands together or use I/O redirection, not all shells treat `jq` options the same. Hence, the `jq` options are put into a file.

I created the file with Windows Notepad.exe, which defaults to UTF-8. This is _important_ for jq later!

`.result.outcome.assertions[] | "\(.status)\t\(.name)"`

Let’s call the file `summary.jq` as proposed by @Adam_Layne

Next, I’ll go through each shell and convert the UTF-16LE `solver.out` file to UTF-8.

### CMD

Let’s check our code page with the `chcp` command. Starting with a newly created CMD shell, the native UTF-16 code page is 437 (OEM United States (Original MS-DOS console character set with line-drawing)

`CMD> chcp`  
`Active code page: 437`

We now can change that to UTF-8 code page (for a list, see [Windows code page - Wikipedia](https://en.wikipedia.org/wiki/Windows_code_page) )

`CMD> chcp 65001`  
`Active code page: 65001`

Because we have changed the code page, the I/O redirect `>` now produces UTF-8 output, and we can issue the command:

`CMD> type solver.out > solver2.out`

The `solver2.out` file is now in UTF-8 format.

### PowerShell (v7)

For PS(v7), the command line is _PFM_ ™!  
The process is:

`PS> Get-Content "solver.out" | Out-File "solver2.out"`

The `solver2.out` file is now in UTF-8 format. Why? Here’s why:

1. `Get-Content` reads the BOM, decodes the UTF-16LE bytes, and loads pure text into memory.
2. The pipeline passes that pure text to the `Out-File` parameter.
3. `Out-File` invokes PowerShell 7’s _default_ encoding parameter (utf8NoBOM, i.e., raw UTF-8) and writes the text as clean, BOM-less UTF-8 bytes.

The `solver2.out` file is now in UTF-8 format.

### Bash

For Bash, the conversion utility `iconv` is used:

`iconv -f UTF-16LE -t UTF-8 solver.out > solver2.out`

The `solver2.out` file is now in UTF-8 format.

===================================================================

In all shells, the `summary.jq` file has to be in UTF-8. Remember the summary.jq file? Yup, it has to be in UTF-8 to work.

`jq -r -f summary.jq solver2.out`  
`satisfied Pump::flowOk`  
`violated Pump::pressureOk`

QED

---

<div class="post-metadata">

**Author:** ![Richard\_Wallace](https://yyz2.discourse-cdn.com/flex008/user_avatar/forum.sensmetry.com/richard_wallace/32/307_2.png) [@Richard\_Wallace](https://forum.sensmetry.com/u/Richard_Wallace)\
**Post date:** [October 5, 2026, 2:40pm UTC](https://forum.sensmetry.com/t/syside-solver-and-use-of-jq-or-powershell-formatting-does-not-match-web-examples/582/6 "2026-10-05T14:40:50Z")

</div>

Of course the simplest correction for all of this is to have the tools write files in UTF-8 encoding, but there may be other issues with that simple fix.

V/r @Richard_Wallace

---

<div class="post-metadata">

**Author:** ![Daumantas](https://yyz2.discourse-cdn.com/flex008/user_avatar/forum.sensmetry.com/daumantas/32/19_2.png) [@Daumantas](https://forum.sensmetry.com/u/Daumantas)\
**Post date:** [October 5, 2026, 3:03pm UTC](https://forum.sensmetry.com/t/syside-solver-and-use-of-jq-or-powershell-formatting-does-not-match-web-examples/582/7 "2026-10-05T15:03:03Z")

</div>

I too would like Windows to at least default to proper Unicode conversions but the code pages are not that. This is the same issue that requires programs to define [wmain](https://learn.microsoft.com/en-us/cpp/c-language/using-wmain?view=msvc-170) on Windows if they want to support Unicode inputs as wide strings do not go through narrowing conversion with some arbitrary code pages. Tried narrow `main` early on and some Unicode characters came in garbled up, instead we perform narrowing manually which preserves input characters.

See [cli — Syside](https://docs.sensmetry.com/python/syside/cli/#syside.cli.main) for more details. Windows is just a mess. (Fun fact: Windows also automatically inserts carriage returns to file output unless they have been opened in binary format)
