Skip to content

Replace unsafe unwrap() calls in character conversion functions #7434

@mango766

Description

@mango766

Problem Description

In several character conversion functions in , there are unsafe calls that can cause panics when handling invalid Unicode characters.

Specifically, these functions use :

  • :
  • :
  • :
  • :

These calls can panic if:

  1. fails (invalid Unicode codepoint)
  2. or returns (empty iterator)

Expected Behavior

These functions should handle invalid inputs gracefully by returning appropriate default values instead of panicking.

Proposed Solution

Replace with safer alternatives like or proper error handling. For example:

  • For case conversion: fall back to the original character if conversion fails
  • For character property checks: return for invalid characters

This would make the code more robust and prevent unexpected crashes when processing malformed or edge-case Unicode input.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions