task.addText(comment);
This comment has HTML tags. So when we send this comment as mail, we see encoded HTML like this in mail:
<h3>asdasas as<b>asdasdas</b>dasdas<u>dasdasdasd<strike>asdasdasdsadasdasdas<span id="selectionBoundary_1493731518682_030677381665187298" class="rangySelectionBoundary"></span></strike></u></h3>
I want to see not tags, i want to see what tag does for UI.
This is from db of email for email body part:
b>asdasdas</b>dasdas<u>dasdasdasd<strike>asdasdasdsadasdasdas<span id="selectionBoundary_1493731518682_030677381665187298" class="rangySelectionBoundary"></span></strike></u></h3></td>\n
this is html part of email:
<p th:if="${!commentsInTask.empty}">Tüm yorumlar: </p>
<table
<tbody>
<tr th:each="allComments : ${comments}">
<tr th:each="comment : ${comments}">
</tr>
</tr>
</tbody>
</table>
</body>
</html>
NOrmally there was no decoding but i saw from here
Java: How to unescape HTML character entities in Java?
and did this
comment=StringEscapeUtils.unescapeHtml(comment);
but did not work.
this is from comment db:
<h3>asdasas as<b>asdasdas</b>dasdas<u>dasdasdasd<strike>asdasdasdsadasdasdas<span id="selectionBoundary_1493731518682_030677381665187298" class="rangySelectionBoundary"></span></strike></u></h3>
it is same as email db
But it should not have changed tags to <
So it means i want to escape html. I tried
escapeHtml but did not work.
or
HtmlEscapers.htmlEscaper().escape(comment)
also we have this while putting to html
Context context = new Context(Locale.forLanguageTag("tr-TR"));
context.setVariables(comment);
and thymeleaf did not work. Converting to <td th:utext is not working.
It is happening between those
Context context = new Context(Locale.forLanguageTag("tr-TR"));
context.setVariables(mail.getParams());
String process = templateEngine.process(mail, context);
because before
Context context = new Context(Locale.forLanguageTag("tr-TR"));
there is nothing. after that line,
context.setVariables(mail.getParams());
it becoming decoded.