Skip to content

use to_unicode in escape_char #1226

@niccokunzmann

Description

@niccokunzmann

escape_char in icalendar.parser should also accept bytes.

_escape_char is annotated to accept bytes, but the current replacement chain uses str patterns/replacements, which will raise TypeError if text is actually bytes. Either add a bytes branch (similar to _unescape_char) or restrict the signature/validation to str only so the type hints match runtime behavior.

Originally posted by @Copilot in #1222

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions