java – Eclipse won’t save html file with dynamic charset

I’m using Thymeleaf template engine, and want to get the charset attribute value for the meta tag on the head block from my project properties, i.e :
<meta th:charset="${@environment.getProperty('html.charset')}">

But when I want to save my html file I get this pop-up error :

Save could not be completed. Try File > Save As… if the problem persists.
Character encoding “${@environment.getProperty(‘html.charset’)}” is not a legal character encoding.

I even tried to save the file from outside of eclipse, but when back on eclipse and want to open the file, I couldn’t access it and got this error :

Unsupported Character Encoding
Character encoding “${@environment.getProperty(‘html.charset’)}” is not supported by this platform.
Set Encoding…

I tried to suspend all validators on eclipse Preferences but this doesn’t resolve the problem.

Any ideas for help ? Thanks in advance.

I’m on Mac OS and using Eclipse IDE for Enterprise Java and Web Developers, Version: 2021-09 (4.21.0).

Read more here: Source link