IntelliJ file encoding issue
Hi, I have cloned a project from repo. When I build the project from my Mac OS terminal, it builds fine.
However , when I open the project the Intellij Ultimate 2019 , and runs the project from IntelliJ terminal , I get compilation issues.
The issue is thrown by on `.less` file. Let me show what IntelliJ shows for some piece of code in this file that is causing the issue.

The error that I get is : Unrecognized input in this less file.

However , when I run the same maven command to build my project from Mac terminal , no such error is shown.
This has lead me to think that IntelliJ is doing something when I open the project in it.
However, in version logs , no diff is there. So I am confused now. Problem happens only when project runs in IntelliJ terminal (or by run configuration)
What can it be ? I see that IntelliJ at the bottom shows the encoding as UTF-8 and so is what I get when I do `file -I` in the Mac OS terminal.

Please sign in to leave a comment.
Could you please provide a file or a project example?
ok. this is the whole `.less` file in my project : https://filebin.net/tq5d4kvf4xtqs35w
Please focus on around code block at line 261 as shown in image above.
Hi.
Looks like the file contains non-breaking spaces. We have a request to fix such a problem automatically, please upvote:
https://youtrack.jetbrains.com/issue/IDEA-212504
Thanks for the reply.
But one doubt though. If I compile my project - `mvn compile` from IntelliJ terminal, compilation fails.
But when run from Mac Os X terminal , it does not fail.
We both agree that IntelliJ does not change anything in the code. So why it fails in one and is successful in other ? Both versions of the code have same non breaking spaces.
Hi. so you just run 'mvn compile' from IDEA terminal and from OsX terminal? Could you please provide a screenshot of the terminal settings (Preferences | Tools | Terminal)?
> so you just run 'mvn compile' from IDEA terminal and from OsX terminal?
yes
Here is the settings :
My Mac Os X terminal :
(and few more encodings which I can show in separate image in case you are interested)
Please let me know if u need any more inputs.
Please run
localecommand in IDEA terminal and in Mac OS terminal. What's the output?In IntelliJ :
$ locale
LANG=
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
In mac os x :
$locale
LANG=
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
What I am not able to understand is that terminal is only used to run maven command. How can it affect the source code ?
As shown in first post image ,
I am getting lesscss-maven-plugin error in IntelliJ terminal but no such error when run in Mac OS x terminal.
Update :
When I type `mvn help:system` , I get this :
IntelliJ Terminal
LC_CTYPE=en_IN.UTF-8
Mac OS X terminal
LC_CTYPE=UTF-8
(The maven command works fine with this )
So, I set this in my .bash_profile
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
And the code compiles fine now in Intellij terminal . (If I would have set en_IN.UTF-8 , then it does not )
Can someone please explain to me why is this happening ? Why maven picking en_IN from IntelliJ terminal and en_US from Mac terminal ?
Thanks, the issue was reproduced if LANG is unset.
As a workaround, please set
LANG="UTF-8"in embedded terminal, it should probably help.Please also try to uncheck "Shell integration" in "Settings | Tools | Terminal" and open a new embedded terminal tab. Will it allow pass
mvn compilecommand correctly? If no, please attach output oflocalecommand with unchecked "Shell integration".