Home > front end >  Eclipse won't save html file with dynamic charset
Eclipse won't save html file with dynamic charset

Time:12-07

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.
Reason:
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).

CodePudding user response:

The charset value is being used, regardless of the prefix, to read and write the file correctly. That there is a prefix on the attribute in a non-prefixed meta tag is a clue that it should be ignored by the normal encoding detection. Please open a Resources page in the Properties dialog

  • Related