Decoding command output in Windows
Closes #2069
As I understand it, using from_utf8_lossy is not suitable for double-byte encodings. A better approach would be to use GetACP to retrieve the system code page and then use the corresponding encoding from encoding_rs to convert it to UTF-8.
from_utf8_lossy will help avoid crashes from panic. The fact that REPLACEMENT_CHARACTERs will be displayed is a different problem imo.
I could solve the encoding issue with a third-party crate, but I have little experience with open-source and don't know if it's ok to add an additional dependency without any discussion from the major contributors.
It can be a Windows only dependency then as it requires special handling anyway, and pgrx already has some Windows specific fixes. So, why not?
Ok, I'll fix the Windows encoding problem then.