Encoding problem. Files opened with UTF-8 without any warning/error
Answered
Hello,
I use Intellij 2018.1 and I have an annoying problem.
Maven project with Cp1252 encoding (defined on poms), everything uses Cp1252.
Some files in the project probably have some UTF-8 characters so the file is opened as UTF-8. The main problem is that there's no warning (even with the Inspection checked) so if I write any special character like àèìòù, the same characters decoded as UTF-8 get converted some way and it generates problems.
The main thing I'd like to have is a warning/error which tells me the file was opened with UTF-8 when the project is defined to use CP-1252.
Thanks for any help.
Please sign in to leave a comment.
Hello Fabio,
Actually there should be a message that file was opened in the wrong encoding. Is it possible to provide any file demonstrating the issue?
I can provide a file, however I remember that message (at the top of the screen), but I didn't see it anymore, maybe after an update in the last 3-4 months. Is there any way it could be disabled?
I didn't turn off the inspection.
I tried to re-create the error which I found in the following strings (there are more characters of course) :
I wrote the strings using UTF-8. If I convert to Windows1252 and I look at differences,
I get the error at the top of the file "Content was decoded with errors (using 'Windows-1252' charset).
I can't find it anywhere else. I'm not sure that's how it worked 4-5 months ago (I kept updating IntelliJ).
I remember I would get notified if an error was present. Don't know how to solve it.
Fabio,
We have related issue on YouTrack: https://youtrack.jetbrains.com/issue/IDEA-178380
I've read that post but I couldn't find any solution yet. Is the issue hard to solve or just random?
Fabio,
It's not fixed yet. We'll provide fix as soon as possible.
Thanks for help.