From: alexandermomchilov@... Date: 2021-06-15T21:48:16+00:00 Subject: [ruby-core:104290] [Ruby master Feature#17992] Upstreaming the htmlentities gem into CGI#.(un)escape_html Issue #17992 has been updated by AMomchilov (Alexander Momchilov). k0kubun (Takashi Kokubun) wrote in #note-1: > Could you clarify a bit more context about why you'd like to escape these characters not supported in CGI.escapeHTML? We have a dataset of user content that contains HTML entities (whether intended or not), which we would like rendered by a non-browser presentation layer. We want our server backend to decode these into their proper characters. You make a good point about the performance. Definitely don't want to touch `escapeHTML`. Granted, the name, "escapeHTML" is about escaping HTML, and not about necessarily decoding HTML entites, so the current behaviour makes sense. What if the more-general (but slower) entity decoding behaviour was added under, say, `(de|en)code_html_entities`? ---------------------------------------- Feature #17992: Upstreaming the htmlentities gem into CGI#.(un)escape_html https://bugs.ruby-lang.org/issues/17992#change-92508 * Author: AMomchilov (Alexander Momchilov) * Status: Feedback * Priority: Normal ---------------------------------------- Hi there, I was looking to unescape some HTML entities in a String, and I discovered that `CGI#.(un)escape_html` is **really** limited. Many StackOverflow questions share a similar disappointment, and point users to using the [htmlentities gem](https://github.com/threedaymonk/htmlentities): 1. https://stackoverflow.com/a/383561/3141234 2. https://stackoverflow.com/a/22926384/3141234 This solved my problem, but I feel like something this standard/universal should be built-in. To that end, I'm interested in working on merging the htmlentities gem into CGI's repo. Would this be a welcome change? * I've e-mailed the author (Paul Battley) privately, and got his blessing to do so. * It's MIT licensed, so that should be OK. -- https://bugs.ruby-lang.org/ Unsubscribe: