I know there's already a question on converting line breaks to <br> tags in Thymeleaf, but the "#strings.replace
" solution from there, relies on getting the line.separator
system property to make it platform neutral. Since Thymeleaf 3.0.12 this is now broken (see this GitHub issue) when used with th:utext
. Is there a recommended replacement for this, other than just using "\n"? For reference, the current line (which we use all over our codebase) looks something like this:
<div th:utext="*{#strings.replace(#strings.escapeXml(fieldName),T(java.lang.System).getProperty('line.separator'),'<br>')}">