]> www.wagner.pp.ru Git - oss/less.git/blobdiff - main.c
Force output codepage to 65001 and restore before quit
[oss/less.git] / main.c
diff --git a/main.c b/main.c
index 149999cd4b537fa1d2b38bb969c18c845305772a..e4f35b9ac72eb34b2c6557999b940c9927d78887 100644 (file)
--- a/main.c
+++ b/main.c
@@ -51,6 +51,7 @@ extern int    jump_sline;
 
 #ifdef WIN32
 static char consoleTitle[256];
+static int  savedConsoleCodePage;
 #endif
 
 extern int     less_is_more;
@@ -103,6 +104,7 @@ main(argc, argv)
                }
        }
        GetConsoleTitle(consoleTitle, sizeof(consoleTitle)/sizeof(char));
+       savedConsoleCodePage = GetConsoleOutputCP();    
 #endif /* WIN32 */
 
        /*
@@ -404,6 +406,7 @@ quit(status)
 #endif
 #ifdef WIN32
        SetConsoleTitle(consoleTitle);
+       SetConsoleOutputCP(savedConsoleCodePage);
 #endif
        close_getchr();
        exit(status);