nickg
02/10/2022, 4:27 PMTim
02/10/2022, 4:47 PMnickg
02/10/2022, 4:59 PMnickg
02/10/2022, 4:59 PMnickg
02/10/2022, 4:59 PMTim
02/10/2022, 5:01 PM´
as HTML, it becomes á
. But somewhere, it seems that what should be Á
is becoming á
and you need to try and track that down.
But I don't think that place is the encodeForHTML
function itself.David Buck
02/10/2022, 5:20 PMAdam Cameron
nickg
02/10/2022, 6:01 PMAdam Cameron
nickg
02/10/2022, 6:03 PMAdam Cameron
nickg
02/10/2022, 6:04 PMAdam Cameron
nickg
02/10/2022, 6:06 PMAdam Cameron
encodeForHtml
etc)nickg
02/10/2022, 6:07 PMnickg
02/10/2022, 6:07 PMAdam Cameron
nickg
02/10/2022, 6:08 PMnickg
02/10/2022, 6:09 PMnickg
02/10/2022, 6:10 PMnickg
02/10/2022, 6:11 PMnickg
02/10/2022, 6:15 PMAdam Cameron
Á
and it's rendering in the email client as a
(not á
or Á
) then this is not an encoding issue. It's just the mail client not doing a good job of what it's been told.David Buck
02/10/2022, 6:15 PMdecodeForHTML()
. You might not either.Adam Cameron
Á
when you could just use Á
?David Buck
02/10/2022, 6:17 PMDavid Buck
02/10/2022, 6:19 PMnickg
02/10/2022, 6:19 PMnickg
02/10/2022, 6:20 PMnickg
02/10/2022, 6:20 PMnickg
02/10/2022, 6:26 PMAdam Cameron
David Buck
02/10/2022, 6:35 PMAdam Cameron
Á
in all email clients, or just a specific one?Adam Cameron
nickg
02/10/2022, 6:39 PMDavid Buck
02/10/2022, 6:51 PMencodeForHTML
). If so, that may suggest a good use case for decodeForHTML
. I would probably decode those messages before inserting them into the database. Then use encodeForHTML
when outputting them to a web page or emailing them.Matt Jones
02/10/2022, 7:00 PMAdam Cameron
decodeForHtml
existed until now.David Buck
02/10/2022, 7:23 PMDavid Buck
02/10/2022, 7:32 PMAdam Cameron
nickg
02/11/2022, 1:47 AMnickg
02/11/2022, 3:04 AMMatt Jones
02/11/2022, 4:17 AMMatt Jones
02/11/2022, 4:48 AM.allowElements(["a","br","p","i","b","em","strong"])
.allowAttributes(["title"]).globally()
.allowStandardUrlProtocols()
.allowAttributes(["href"]).onElements(["a"]).requireRelNofollowOnLinks()
for getting start with rules on jsoup, you start with one of their basic rulesets then add to it. none() is essentially the same as the java html sanitizer with nothing allowed. https://jsoup.org/apidocs/org/jsoup/safety/Safelist.html
adding rules looks like this
.addTags(["br","p","i","b","em","strong"])
.addAttributes(":all", ["title"])
.addAttributes("a", ["href"])
.addEnforcedAttribute("a", "rel", "nofollow")
nickg
02/11/2022, 5:07 AMMatt Jones
02/11/2022, 6:01 AM.allowAttributes(["allowfullscreen","allowtransparency","frameborder","height","scrolling","src","width"]).onElements(["iframe"])