Creating Colored Console Output in Python

Python's built-in print function can output text with custom colors and styles using ANSI escape codes. The general format is \[display_style];[foreground_color];[background_color]m followed by the text, and then \[0m to reset the formatting. Display Styles: 0: Default 1: Bold 4: Underline 5: Blink 7: Reverse video Example for display styles: ...

Posted on Sat, 24 Oct 2026 16:28:10 +0000 by Malcina

Colorizing Shell Script Logs with ANSI Escape Codes

Introduction Shell scripts can be made more readable by adding color to they output. This is achieved by embedding ANSI escape codes direct into the output stream. These codes are interpreted by most modern terminals to change text attributes like color. Below is a comprehensive guide on how to implement colored logging in a Bash script. Comple ...

Posted on Fri, 10 Jul 2026 17:06:15 +0000 by borris_uk

Character Encoding Conversion Techniques in C++

// Convert UTF-8 to GB2312 char* ConvertUTF8ToGB(const char* utfInput) { int bufferSize = MultiByteToWideChar(CP_UTF8, 0, utfInput, -1, NULL, 0); wchar_t* wideBuffer = new wchar_t[bufferSize+1]; memset(wideBuffer, 0, (bufferSize+1)*sizeof(wchar_t)); MultiByteToWideChar(CP_UTF8, 0, utfInput, -1, wideBuffer, bufferSize); ...

Posted on Mon, 22 Jun 2026 17:59:29 +0000 by Reformed