Git natively uses UTF-8 (Unicode) to store commit messages and metadata, but older Windows terminals (like Command Prompt) historically default to legacy encodings (e.g., CP437 or CP1252). This mismatch causes UTF-8 characters to be misinterpreted, resulting in "mojibake" (garbled text).
In this guide, we’ll demystify the root causes of encoding issues and walk through step-by-step solutions to ensure git log displays diacritical characters correctly in Windows 10. We’ll cover fixes for Command Prompt, PowerShell, and the modern Windows Terminal, along with Git configuration tweaks.
To fix encoding issues, it helps to first understand why they occur:
Git’s Default Encoding: Git stores commit messages, branch names, and file paths in UTF-8 (Unicode), a universal encoding that supports all languages. This is non-negotiable for Git’s internal operations.
Windows Terminal Defaults: Older Windows terminals (Command Prompt, legacy PowerShell) default to legacy encodings like:
CP437 (Code Page 437): Used in older DOS systems, limited to 256 characters (no diacritics).
CP1252 (Windows-1252): Western European encoding, supports some diacritics but not all Unicode characters.
Search for terminal.integrated.defaultProfile.windows and set to your preferred terminal (e.g., "Command Prompt" or "PowerShell").
For Notepad:
Notepad defaults to ANSI (CP1252) for new files. To save commit messages in UTF-8:
When git commit opens Notepad, type your message.
Go to File → Save As.
Set "Encoding" to "UTF-8" (not "UTF-8 with BOM").
3.4 Use Windows Terminal (Recommended for Modern UTF-8 Support)#
The legacy Command Prompt and PowerShell have limited UTF-8 support. For a smoother experience, use Microsoft’s Windows Terminal (free, pre-installed on Windows 11; downloadable for Windows 10).
Some fonts (e.g., Raster Fonts) lack Unicode support. In any terminal, ensure you’re using a TrueType font like Consolas, Cascadia Code, or Lucida Console.
Fixing git log encoding issues in Windows 10 boils down to matching Git’s UTF-8 output with your terminal’s encoding. Follow these key steps:
Enforce UTF-8 in Git with i18n.logOutputEncoding and core.quotepath=false.
Set your terminal (Command Prompt/PowerShell) to use UTF-8 (code page 65001) and a Unicode font.
Use Windows Terminal for the best UTF-8 support.
Ensure commit messages are saved in UTF-8 via your editor.
With these changes, diacritical characters like é, ü, and ñ will display correctly in git log, making your Git workflow smoother—especially in multilingual teams!