9 Replies Last post: Jan 26, 2012 12:16 AM by Michael Newcomb  
Nicolas Labrot Newbie 11 posts since
Dec 16, 2010
Currently Being Moderated

Nov 8, 2011 7:06 PM

Unmappable character for encoding UTF-8

Hello,

 

Intellij version : 110.291

Maven version : 2.2.1

 

Intellij then I compile some classes output : "unmappable character for encoding UTF-8".

 

The encoding in my POM is set to CP1252. The project encoding (and even file encoding!!) in setting > File encodings is set to windows-1252. The checkbox autodetect UTF-encoded file is unchecked. The files in "error" are opened by Intellij with windows-1252.

 

So why do Intellij try to compile the file with UTF-8 ???

 

Thanks for your help!

 

Nicolas

Kirill Safonov Apprentice 584 posts since
Jul 9, 2009
Currently Being Moderated
Nov 8, 2011 8:45 PM in response to: Nicolas Labrot
Re: Unmappable character for encoding UTF-8

IDE passes project encoding to Javac via '-encoding' command line argument.

Alexander Chernikov JetBrains 1,101 posts since
Jan 11, 2007
Currently Being Moderated
Nov 9, 2011 6:10 PM in response to: Nicolas Labrot
Re: Unmappable character for encoding UTF-8

Yes.

 

The issue is that only one encoding setting is provided for the compiler. It's not per file.

 

Alexander.

Michael Newcomb Newbie 24 posts since
Dec 8, 2005
Currently Being Moderated
Jan 25, 2012 7:15 AM in response to: Kirill Safonov
Re: Unmappable character for encoding UTF-8

Why does it do this?

 

When I compile with ant on the command line, it works all fine, no errors.

 

I just upgraded from 10.5 to 11 and boom, I get this error again!

 

I sing the praises of IntelliJ to everyone I meet, but this is ridiculous.

 

Please tell me how I can IntelliJ to not do what it is doing and just build as if I executed javac XXX.java on the command line. Javac seem perfectly capable of detecting the encoding without the -encoding flag.

Michael Newcomb Newbie 24 posts since
Dec 8, 2005
Currently Being Moderated
Jan 25, 2012 11:51 PM in response to: Nicolas Labrot
Re: Unmappable character for encoding UTF-8

The project encoding is set to UTF-8.

 

So any files I create I want encoded in UTF-8.

 

I have one file that is part of a 3rd party interface spec (just delivered in source form, no binaries) that is windows-1252. All the other files are UTF-8. I have setup the encoding for that one file to be windows-1252.

 

I have an ant script that builds everything and it works fine. I guess it is *not* passing -encoding flag to javac. However, IntelliJ passes -encoding flag for the project and javac thinks this file is UTF-8 when it isn't.

 

I guess what I'm looking for is a way to tell IntelliJ just to chill and not pass that -encoding flag. Does IntelliJ pass -encoding when the project encoding is set? Perhaps splitting that setting to says 'create files in this encoding' and 'check to pass that encoding to javac' or something.

 

I just don't understand why I can compile file on the command line (mixing UTF-8 and windows-1252 encoded files) fine, but it blows up in IntelliJ.

Michael Newcomb Newbie 24 posts since
Dec 8, 2005
Currently Being Moderated
Jan 26, 2012 12:16 AM in response to: Nicolas Labrot
Re: Unmappable character for encoding UTF-8

I will test it when I get home.

 

Thanks!

More Like This

  • Retrieving data ...