mirror of https://github.com/adamdruppe/arsd.git
set utf8 mode on windows too
This commit is contained in:
parent
204c95760e
commit
ab1f92fc93
12
terminal.d
12
terminal.d
|
@ -804,11 +804,19 @@ http://msdn.microsoft.com/en-us/library/windows/desktop/ms683193%28v=vs.85%29.as
|
||||||
|
|
||||||
defaultForegroundColor = cast(Color) (originalSbi.wAttributes & 0x0f);
|
defaultForegroundColor = cast(Color) (originalSbi.wAttributes & 0x0f);
|
||||||
defaultBackgroundColor = cast(Color) ((originalSbi.wAttributes >> 4) & 0x0f);
|
defaultBackgroundColor = cast(Color) ((originalSbi.wAttributes >> 4) & 0x0f);
|
||||||
|
|
||||||
|
oldCp = GetConsoleOutputCP();
|
||||||
|
SetConsoleOutputCP(65001); // UTF-8
|
||||||
|
|
||||||
|
oldCpIn = GetConsoleCP();
|
||||||
|
SetConsoleCP(65001); // UTF-8
|
||||||
}
|
}
|
||||||
|
|
||||||
version(Windows) {
|
version(Windows) {
|
||||||
private Color defaultBackgroundColor = Color.black;
|
private Color defaultBackgroundColor = Color.black;
|
||||||
private Color defaultForegroundColor = Color.white;
|
private Color defaultForegroundColor = Color.white;
|
||||||
|
UINT oldCp;
|
||||||
|
UINT oldCpIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
// only use this if you are sure you know what you want, since the terminal is a shared resource you generally really want to reset it to normal when you leave...
|
// only use this if you are sure you know what you want, since the terminal is a shared resource you generally really want to reset it to normal when you leave...
|
||||||
|
@ -843,6 +851,10 @@ http://msdn.microsoft.com/en-us/library/windows/desktop/ms683193%28v=vs.85%29.as
|
||||||
if(lineGetter !is null)
|
if(lineGetter !is null)
|
||||||
lineGetter.dispose();
|
lineGetter.dispose();
|
||||||
|
|
||||||
|
|
||||||
|
SetConsoleOutputCP(oldCp);
|
||||||
|
SetConsoleCP(oldCpIn);
|
||||||
|
|
||||||
auto stdo = GetStdHandle(STD_OUTPUT_HANDLE);
|
auto stdo = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
SetConsoleActiveScreenBuffer(stdo);
|
SetConsoleActiveScreenBuffer(stdo);
|
||||||
if(hConsole !is stdo)
|
if(hConsole !is stdo)
|
||||||
|
|
Loading…
Reference in New Issue