[PATCH 4/4] programs/attrib: write redirected output in UTF8

Eric Pouech eric.pouech at gmail.com
Fri Apr 15 07:48:42 CDT 2022


Signed-off-by: Eric Pouech <eric.pouech at gmail.com>

---
 programs/attrib/attrib.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/programs/attrib/attrib.c b/programs/attrib/attrib.c
index 4344200b3ec..00c852b24f4 100644
--- a/programs/attrib/attrib.c
+++ b/programs/attrib/attrib.c
@@ -86,7 +86,8 @@ static int WINAPIV ATTRIB_wprintf(const WCHAR *format, ...)
     }
 
     /* If writing to console has failed (ever) we assume it's file
-       i/o so convert to OEM codepage and output                  */
+     * i/o so convert to UTF8 and output
+     */
     if (!res) {
         BOOL usedDefaultChar = FALSE;
         DWORD convertedChars;
@@ -103,10 +104,10 @@ static int WINAPIV ATTRIB_wprintf(const WCHAR *format, ...)
           return 0;
         }
 
-        /* Convert to OEM, then output */
-        convertedChars = WideCharToMultiByte(CP_ACP, 0, output_bufW,
+        /* Convert to UTF8, then output */
+        convertedChars = WideCharToMultiByte(CP_UTF8, 0, output_bufW,
                             len, output_bufA, MAX_WRITECONSOLE_SIZE,
-                            "?", &usedDefaultChar);
+                            NULL, &usedDefaultChar);
         WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), output_bufA, convertedChars,
                   &nOut, FALSE);
     }




More information about the wine-devel mailing list