pgrx icon indicating copy to clipboard operation
pgrx copied to clipboard

Decoding command output in Windows

Open if0ne opened this issue 7 months ago • 4 comments

Closes #2069

if0ne avatar Jun 11 '25 11:06 if0ne

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.

usamoi avatar Jun 15 '25 12:06 usamoi

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.

if0ne avatar Jun 16 '25 07:06 if0ne

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?

YohDeadfall avatar Jun 16 '25 14:06 YohDeadfall

Ok, I'll fix the Windows encoding problem then.

if0ne avatar Jun 17 '25 07:06 if0ne