Issue #17992 has been updated by duerst (Martin D=FCrst).


It is difficult to make this complete without overdoing it because there ar=
e many different kinds of entity sets. The htmlentities gem distinguishes t=
hree (html4, xhtml1, and expanded). Both html4 and xhtml1 come in at around=
 250 entities; expanded is around 1000. But it doesn't include the html5 se=
t, which seems to be even bigger (https://html.spec.whatwg.org/entities.jso=
n contains 2231 entries, although some of them are duplicates (with and wit=
hout semicolon)). It is highly unclear what the correct set would be if we =
expand the coverage of CGI.escapeHTML and friends.

----------------------------------------
Feature #17992: Upstreaming the htmlentities gem into CGI#.(un)escape_html
https://bugs.ruby-lang.org/issues/17992#change-92701

* 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 quest=
ions share a similar disappointment, and point users to using the [htmlenti=
ties 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 s=
hould be built-in. To that end, I'm interested in working on merging the ht=
mlentities gem into CGI's repo. Would this be a welcome change?

* I've e-mailed the author (Paul Battley) privately, and got his blessing t=
o do so.
* It's MIT licensed, so that should be OK.




-- =

https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=3Dunsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>