![]() ![]() Sorry for the maybe trivial question, but it is the first time I deal with Windows cpp functions. If I don't use the enableANSI function the unicode characters works well. The problem is that it seems that the function to enable ANSI at the same time disable some Unicode characters, in particular: "\u250c", "\u2500", "\u2510", "\u2502", "\u2502", "\u2514", "\u2500", "\u2518" which if sent to the output stream show strange symbols instead of their corresponding characters. They are used respectively to enable and disable ANSI escape sequences and work well. If( ! SetConsoleMode( stdoutHandle, outModeInit ) ) Apparently Node itself has some sort of support for translating ANSI escape sequences into the Windows console APIs, but this gets lost when redirecting or capturing output (the file written when doing a shell redirect contains the escape sequences as well). If( ! SetConsoleMode( stdoutHandle, outMode ) ) OutMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING The change was designed to complement the Windows Subsystem for Linux, adding to the Windows Console Host used by Command Prompt support for character escape codes used by terminal-based software for Unix-like systems. If( ! GetConsoleMode( stdoutHandle, &outMode ) ) In 2016, Microsoft released the Windows 10 Version 1511 update which unexpectedly implemented support for ANSI escape sequences. If( stdoutHandle = INVALID_HANDLE_VALUE ) StdoutHandle = GetStdHandle( STD_OUTPUT_HANDLE ) ![]() ANSICON injects a DLL into a process, hooking its functions. 32-bit: Windows 2000 Professional and later (it won't work with NT or 9X). It provides much the same functionality as ANSI.SYS does for MS-DOS. Create a DWORD key (if necessary) and set its value to 1 to globally enable (or 0 to disable) ANSI processing by default. ANSICON provides ANSI escape sequences for Windows console programs. #define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004 The registry key at HKEYCURRENTUSER\Console\VirtualTerminalLevel sets the global default behavior for processing ANSI escape sequences. #ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING I recently enabled ANSI escape sequences on my Windows console using this functions defined in an header my_windows.h: #ifndef WINDOWS_HPPĪnd implemented in my_windows.cpp #ifdef _WIN32 ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |