Skip to content

Conversation

dwisiswant0
Copy link
Member

@dwisiswant0 dwisiswant0 commented Sep 16, 2025

Package html extends the standard Go html package with more comprehensive HTML escaping capabilities.

While the standard library's html.EscapeString only escapes a minimal set of characters ('<', '>', '&', ”', '"'), this package provides an EscapeString function that converts a much wider range of characters into their corresponding HTML named character references from the W3C specification. This includes support for two-codepoint composite characters and ensures all entities are semicolon-terminated.

For convenience, aliases for the standard library's html.EscapeString (EscapeStringStd) and html.UnescapeString are also provided.

A key invariant of this package is that for any string s, UnescapeString(EscapeString(s)) == s.


Ref projectdiscovery/dsl#259

Signed-off-by: Dwi Siswanto <[email protected]>
@Mzack9999 Mzack9999 merged commit f7f96d3 into main Sep 24, 2025
7 checks passed
@Mzack9999 Mzack9999 deleted the dwisiswant0/feat/adds-html-package branch September 24, 2025 20:43
@dwisiswant0
Copy link
Member Author

@Mzack9999 can we bump for this?

@Mzack9999
Copy link
Member

@dwisiswant0 sure!

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.

2 participants