On a PVE cluster I noticed that xterm.js shells behave differently depending on whether the shell is opened on the node serving the Web UI or on another cluster node.
Reproduction:
* Open the PVE Web UI on node A.
* Open `Shell` for node A:
`locale charmap` → `UTF-8`, `LC_ALL` unset.
* From the same Web UI open `Shell` for node B:
`locale charmap` → `ANSI_X3.4-1968`, `LC_ALL=C`.
* Accessing node B's Web UI directly and opening its local shell gives UTF-8 again.
This breaks TUI applications using `wcwidth()` for Unicode/emoji characters. Wide emoji are rendered with incorrect cell widths and overlap following characters.
The remote shell is started through SSH. `sshd` accepts:
```
AcceptEnv LANG
AcceptEnv LC_*
```
As a confirmation, starting the remote shell with:
```
ssh -o 'SendEnv=-LC_ALL' nodeB
```
immediately fixes the problem and UTF-8/emoji rendering works correctly.
There seems to be a relevant difference in the current `pve-manager` source:
`PVE/API2/Nodes.pm`
The `vncshell` path calls:
```
PVE::Tools::run_command($cmd, errmsg => "vncterm failed", keeplocale => 1);
```
while the `termproxy` path calls:
```
PVE::Tools::run_command($cmd, afterfork => $afterfork);
```
without `keeplocale => 1`.
There is also an older Proxmox patch ("keep locale for vncshell and spiceshell", Feb 2017) explicitly stating that `run_command` sets `LC_ALL`, which appears closely related.
Could `termproxy` require `keeplocale => 1` as well?
Reproduction:
* Open the PVE Web UI on node A.
* Open `Shell` for node A:
`locale charmap` → `UTF-8`, `LC_ALL` unset.
* From the same Web UI open `Shell` for node B:
`locale charmap` → `ANSI_X3.4-1968`, `LC_ALL=C`.
* Accessing node B's Web UI directly and opening its local shell gives UTF-8 again.
This breaks TUI applications using `wcwidth()` for Unicode/emoji characters. Wide emoji are rendered with incorrect cell widths and overlap following characters.
The remote shell is started through SSH. `sshd` accepts:
```
AcceptEnv LANG
AcceptEnv LC_*
```
As a confirmation, starting the remote shell with:
```
ssh -o 'SendEnv=-LC_ALL' nodeB
```
immediately fixes the problem and UTF-8/emoji rendering works correctly.
There seems to be a relevant difference in the current `pve-manager` source:
`PVE/API2/Nodes.pm`
The `vncshell` path calls:
```
PVE::Tools::run_command($cmd, errmsg => "vncterm failed", keeplocale => 1);
```
while the `termproxy` path calls:
```
PVE::Tools::run_command($cmd, afterfork => $afterfork);
```
without `keeplocale => 1`.
There is also an older Proxmox patch ("keep locale for vncshell and spiceshell", Feb 2017) explicitly stating that `run_command` sets `LC_ALL`, which appears closely related.
Could `termproxy` require `keeplocale => 1` as well?