pve 9.0.3 exec API returns json with unescaped control character 0x0081

rho4

New Member
Dec 2, 2025
1
0
1
I'm trying to sync time after rolling back a Win11 snapshot.

Using the exec API enpoint to run cmd /c "w32tm /resync", my json library fails to parse the response because of an unescaped control character:

Response:
{"data":{"exitcode":0,"out-data":"Befehl zum erneuten Synchronisieren wird an den lokalen Computer gesendet.\nDer Computer wurde nicht synchronisiert, da keine Zeitdaten verfgbar waren.\r\n","exited":1}}

Error:
"unescaped control character in string value: 0x0081"

GPT thinks (probably correctly) that the command ouput is encoded in Cp1252 (default windows codepage), but the QEMU agent or something tries to parse it in UTF-8, which results in trying to parse the "ü" in "verfügbar", which is an illegal byte in UTF-8 (0xFC), which is then converted to 'unknown character 0x81'.

This would still be fine if 0x81 was correctly encoded as \u0081 as per the json spec.

Suggestions:
- correctly escape control characters in API response json
- and/or ensure that the exec command output is read in the correct encoding
- and/or give an API parameter to specify the expected output encoding