Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Follow conventional commits: `<type>: <subject>`
- [ ] I've tested my changes locally
- [ ] I've followed the code principles (SOLID, DRY, KISS)
- [ ] My PR is small and focused (< 400 lines ideally)
- [ ] **(Python only)** All file operations specify `encoding="utf-8"` for text files

## CI/Testing Requirements

Expand Down
58 changes: 58 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,64 @@ export default function(props) {
- End files with a newline
- Keep line length under 100 characters when practical

### File Encoding (Python)

**Always specify `encoding="utf-8"` for text file operations** to ensure Windows compatibility.

Windows Python defaults to `cp1252` encoding instead of UTF-8, causing errors with:
- Emoji (🚀, ✅, ❌)
- International characters (ñ, é, 中文, العربية)
- Special symbols (™, ©, ®)

**DO:**

```python
# Reading files
with open(path, encoding="utf-8") as f:
content = f.read()

# Writing files
with open(path, "w", encoding="utf-8") as f:
f.write(content)

# Path methods
from pathlib import Path
content = Path(file).read_text(encoding="utf-8")
Path(file).write_text(content, encoding="utf-8")

# JSON files - reading
import json
with open(path, encoding="utf-8") as f:
data = json.load(f)

# JSON files - writing
with open(path, "w", encoding="utf-8") as f:
json.dump(data, f, ensure_ascii=False, indent=2)
```

**DON'T:**

```python
# Wrong - platform-dependent encoding
with open(path) as f:
content = f.read()

# Wrong - Path methods without encoding
content = Path(file).read_text()

# Wrong - encoding on json.dump (not open!)
json.dump(data, f, encoding="utf-8") # ERROR
```

**Binary files - NO encoding:**

```python
with open(path, "rb") as f: # Correct
data = f.read()
```

Our pre-commit hooks automatically check for missing encoding parameters. See [PR #782](https://github.com/AndyMik90/Auto-Claude/pull/782) for the comprehensive encoding fix and [guides/windows-development.md](guides/windows-development.md) for Windows-specific development guidance.

## Testing

### Python Tests
Expand Down
2 changes: 2 additions & 0 deletions guides/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Detailed documentation for Auto Claude setup and usage.
| Guide | Description |
|-------|-------------|
| **[CLI-USAGE.md](CLI-USAGE.md)** | Terminal-only usage for power users, headless servers, and CI/CD |
| **[windows-development.md](windows-development.md)** | Windows-specific development guide (file encoding, paths, line endings) |
| **[linux.md](linux.md)** | Linux-specific installation and build guide (Flatpak, AppImage) |

## Quick Links

Expand Down
Loading
Loading