For this code:
The output is:
.NET Core 5.0.1
Note: works fine in LINQPad 5.44.0 but messy in LINQPad 6.12.2:
This fails for me in both LINQPad 5 and 6.
I'm not sure whether it's possible to fix this without adding an argument to Util.Cmd to specify an encoding. LINQPad uses cmd.exe /c to execute shell commands such as 'echo'. And as far as I can see, cmd.exe doesn't have an option to force UTF-8. It has an option for UTF-16 (the /u switch), but while /u would support the scenario above, it would fail if the command called a program that wrote UTF-8 to stdout.
Note that this problem will not occur if you call Util.Cmd with an executable rather than a shell command.
I guess this is the solution - I'll add an overload to Util.Cmd that accepts an encoding. Then you can pass in Encoding.Unicode (to override the default of Encoding.UTF8).
Try the latest beta:https://www.linqpad.net/linqpad6.aspx#beta