Skip to content

Raise ICalDecodeError for calendar data that is not UTF-8 - #2063

Open
Hrittik20 wants to merge 12 commits into
PyCalendar:mainfrom
Hrittik20:1793-fail-on-invalid-utf8
Open

Hrittik20 wants to merge 12 commits into
PyCalendar:mainfrom
Hrittik20:1793-fail-on-invalid-utf8

Conversation

@Hrittik20

@Hrittik20 Hrittik20 commented Nov 5, 2026 •

Copy link
Copy Markdown

Linked issue

Description

As discussed in #1793, parsing bytes that are not valid UTF-8 now raises a new ICalDecodeError instead of silently replacing them with U+FFFD. The encoding is not guessed. If users know the encoding, they can decode the data themselves, as documented in the parse errors how-to and the upgrade guide.

Checklist

  • I added a change log entry, following the instructions in all subsections under Change log requirements.
  • I followed icalendar's Artificial intelligence policy and disclosed my Responsible AI use in my commit messages, if applicable.
  • I added or updated tests, if applicable.
  • I ran and ensured all tests pass locally by following Run tests.
  • I added or edited documentation as necessary, both as docstrings to be rendered in the API documentation and narrative documentation, following the Style guide.

AI: Claude Opus 5.5 drafted the code, tests and docs. I reviewed them.
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Thanks for the pull request, @Hrittik20! A maintainer will review it shortly.

@github-actions github-actions Bot added the ai-suspicion This contribution is possibly created with lots of AI help without enough human understanding. label Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

One or more PR-quality checks did not pass. Review the PR Quality Checks summary in the workflow run for the failed checks and their details, then make any necessary updates.

Checklist items may remain unchecked while work is in progress. Please tick each item as you complete it.

If you used AI assistance, follow the project's Responsible AI use policy and provide the required disclosures.

angatha
angatha previously approved these changes Nov 21, 2026

@angatha angatha left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THis needs a doc review but code changes look great

@stevepiercy stevepiercy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I enjoying reviewing your excellent work, @hrittik, and I'm glad to see you here in icalendar as well as Plone. I made a few suggestions for improvements, and check about my interpretation of the RFC section. Would you please take care? Thank you!

Comment thread src/icalendar/error.py Resolved
Comment thread src/icalendar/error.py Resolved
Comment thread src/icalendar/error.py Resolved
Comment thread src/icalendar/error.py Resolved
Comment thread news/1793.breaking Resolved
Comment thread src/icalendar/parser_tools.py Resolved
Comment thread docs/how-to/parse-errors.rst Resolved
Hrittik20 and others added 8 commits November 23, 2026 19:07
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>

This branch has not been deployed

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

Labels

ai-suspicion This contribution is possibly created with lots of AI help without enough human understanding.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Non-UTF-8 calendar files are silently corrupted with replacement characters

3 participants