From 934614ec8e6462678c7caaaece0bad62a28e8d6a Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Wed, 4 Nov 2009 20:56:15 +0100 Subject: [PATCH] Temporarily set the console codepage to match the GUI codepage When launching .bat or .cmd files, cmd.exe performs a conversion from the OEM to the ANSI codepage of any arguments. For git.exe's console output, we need to do the opposite conversion by temporarily setting the OEM codepage to match the ANSI codepage. Signed-off-by: Sebastian Schuberth --- cmd/git.cmd | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/git.cmd b/cmd/git.cmd index 95ceda6e..048f6155 100644 --- a/cmd/git.cmd +++ b/cmd/git.cmd @@ -12,7 +12,15 @@ @if "%1"=="gui" @goto gui :default +@rem Get the current console ("OEM") codepage. +@for /f "tokens=4" %%i in ('chcp') do @set cp_oem=%%i +@rem Get the current GUI ("ANSI") codepage. +@for /f "skip=2 tokens=3" %%i in ('reg query HKLM\SYSTEM\CurrentControlSet\Control\Nls\CodePage /v ACP') do @set cp_ansi=%%i +@rem Set the console codepage to match the GUI codepage. +@chcp %cp_ansi% > nul @git.exe %* +@rem Restore the original console codepage. +@chcp %cp_oem% > nul @goto quit :gui -- 2.11.4.GIT