treeScannerC/doc/unicode_console.md
Adam Skotarczak 4a9b5e77f3
v1.0.0
- C-Template für CLI Tools
2025-05-09 22:46:31 +02:00

38 lines
862 B
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Unicode vs ANSI in der Windows-Konsole
Standardmäßig nutzt die Windows-Konsole eine ANSI-Codepage (z.B. 850 oder 1252). Für echte Unicode-Zeichen wie 📁 oder ✓ ist das oft ungeeignet.
## Problem
- Ohne UTF-8: Unicode-Zeichen erscheinen als Kästchen oder Müll
- Ausgabe wie `📁` ergibt `ƒôü` oder ähnliches
## Lösung
### 1. UTF-8 aktivieren
```c
#include <windows.h>
SetConsoleOutputCP(65001); // Codepage 65001 = UTF-8
```
### 2. Kompiler-Flag setzen
```cmd
cl /utf-8 main.c ...
```
### 3. Terminal unterstützen lassen
- `cmd.exe`: nur begrenzt tauglich
- **Windows Terminal**: beste Wahl
- PowerShell (v7+) ebenfalls ok
### 4. Schriftart beachten
- Monospace + Unicode-fähig: `Cascadia Code`, `Segoe UI Emoji`, `Fira Code`
## Hinweis
- Auch Eingabe (`SetConsoleCP`) kann auf UTF-8 gesetzt werden, wird aber selten benötigt