Skip to content

feat(core): support non-UTF-8 encoded iCalendar input - #165

Merged
SashankBhamidi merged 1 commit into
mainfrom
feat/legacy-encoding-support-160
Sep 12, 2026
Merged

SashankBhamidi merged 1 commit into
mainfrom
feat/legacy-encoding-support-160

Conversation

@SashankBhamidi

Copy link
Copy Markdown
Member

Summary

  • Legacy calendar exports (Lotus Notes, pre-Unicode Outlook) are often Windows-1252 or Latin-1 with no declared charset. A shared decode helper tries UTF-8, then cp1252, then Latin-1 as a last resort that never fails.
  • A declared charset (Content-Type header, multipart upload type) is honored first, with a safe fallback if it's wrong.
  • CLI gets a --encoding flag to force a codec instead of auto-detecting.
  • Fixes /fetch and /fernet/{token} silently corrupting non-UTF-8 calendars into replacement characters, since they relied on httpx's own lossy text decoding.
  • Detection stays scoped to cp1252/Latin-1. A broader candidate list made wrong guesses more likely, not less, since these code pages overlap too much to tell apart at typical calendar field length.

Closes #160

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 icalendar-anonymizer | 🛠️ Build #34528016 | 📁 Comparing be49c8f against latest (42ce9fb)

  🔍 Preview build  

1 file changed
± changelog.html

@codecov

codecov Bot commented Sep 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@SashankBhamidi
SashankBhamidi merged commit 86d88bc into main Sep 12, 2026
15 checks passed
@SashankBhamidi
SashankBhamidi deleted the feat/legacy-encoding-support-160 branch September 12, 2026 18:59
@niccokunzmann

niccokunzmann commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

Is this also relevant for the icalendar library? Then, please open an issue. We only use utf-8.

@SashankBhamidi

Copy link
Copy Markdown
Member Author

Is this also relevant for the icalendar library? Then, please open an issue. We only use utf-8.

Yes, same issue. I'll open an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support non-UTF-8 encoded iCalendar files

2 participants