Skip to content

HTML escaping and unescaping is slow and incomplete #14

Closed

Description

@lpil

Hello!

The escaping and unescaping functions use string.replace, but that's unfortunately slow as it'll make a full copy of the entire string for each call to the replace function.

The unescape function is also somewhat incomplete as it only unescapes some HTML entities, the majority of them being left as-is.

Perhaps you could depend on the established libraries for escaping and unescaping HTML in Gleam?

Cheers,
Louis

Activity

  1. lupodevelop commented on Jan 8, 2026

    @lupodevelop
    Owner

    @lpil : I’ve gone ahead and implemented what you suggested, there’s a dedicated branch now. I’ll wait a few days and try it out when I have some time, then merge it.

    Honestly, I hadn’t known about either of those libraries before; str was mostly born from a mystical focus of passion and chaos 😅. And yeah… a little bit of that shows in how things were originally wired up.

    Thanks!

  2. lpil commented on Jan 8, 2026

    @lpil
    Author

    Sweet!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions