[guile-lib] html->sxml does not decode entities in attributes
Tomas Volf <[email protected]> Tue, 04 Feb 2025 21:58:08 +0100
| Newsgroups | gmane.lisp.guile.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello, I think I found a bug in the htmlprag module in guile-lib. When parsing attributes, the values are not properly decoded: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> ,use (htmlprag) scheme@(guile-user)> (html->sxml "<hr aaa=\"bbb"ccc'ddd\" />") $1 = (*TOP* (hr (@ (aaa "bbb"ccc'ddd")))) scheme@(guile-user)> (html->sxml "<a href=\"a&b\" />") $2 = (*TOP* (a (@ (href "a&b")))) --8<---------------cut here---------------end--------------->8--- I think that $1 should be "bbb\"ccc'ddd" and $2 should be "a&b". The annoying part is that this cannot really be changed now, because people (me included) already have workarounds in place, and automatically decoding now would lead to double decoding. I see few ways forward: 1. Document the current behavior and keep it as it is. 2. Add argument #:decode-attributes, defaulting to #f, to the relevant procedures, so that people can opt into the fixed behavior. 3. Introduce parameter %decode-attributes, so that people can opt into the fixed behavior. I am sure there are also other approaches possible. Have a nice day, Tomas -- There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.
signature.asc
(application/pgp-signature, 853 B)
-----BEGIN PGP SIGNATURE----- iQJCBAEBCgAsFiEEt4NJs4wUfTYpiGikL7/ufbZ/wakFAmeif2EOHH5Ad29sZnNk ZW4uY3oACgkQL7/ufbZ/walgCg/9HJMLqDt8BV77qBr5MX/W2CBpi3JxSMtCY4Ao a3eyXbsrKmT2YPu3Z3WuD4N2Wm8P4bzYJbMxLnfNTtqgV7kjwrGuMKXuz7Mt1HfH GwdXYBBkP+EhwizRWUFcMaxZ4R5PUVutZmZpSIAHTiVH7UdBnaHWnXjwIKxkdaSA 9lqDsMFBNzKmiTQz8C1JWEPYOQwa+36+pehqfscwAmJO46iwP/9ZXDDfPDo814gf VqWAN4PcCz1rAlB0u88ZMlqwI6L/st4fLhCLOo2OHLjk1hDwyjYprcsxdNqIqxji HSDc1/iI7KvE3l7qW5ITJrmaNMzGaeEjD0c8ISnS9rEPvmksPoFNjiC6vpv4e+SD FpRWuIiIGO4xdLVK8ZCFhcT/+zYXvCHfouPkKNEmFEBiKXCDOrofrZhbqJk1bUa2 zl2qvRabnpd5mjCPMySYmee/8DsQMeRn/CqzqyKqakxP5Yvtq0bpr28KCHb9mupv yrP2aUhZQNg5NIH3MBuI7eHA4XD8sdiNrDI82Uu0zEu8qfMUTLtJxW/U/QfoQ/Eb 0A1mMb/THr0SGtjaqpnvD6YYVG/asy7HJIeEMOz/RBFqNbu/Au3yy0j6wxmNJ16u 5lZb7CkeJCKcx9wzMuIYf/EmGxtw+tXpC/tVUHMLgGrNQ0E5Sx69FLwKfQGnUavS DHSWk2c= =vCuH -----END PGP SIGNATURE-----