Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij IDEA: "unmappable character for encoding UTF-8" compiling ISO-8859-1 files

I have a mixed-encoding source tree and I'm getting the warning above for some of my source files. I managed to sucessfully set the encoding for those files to ISO 8859-1 and, after invalidating IDEA's caches, they now display correctly in the editor. However, when I compile, I still get the error message.

Production builds use ant and it's not an issue there, but it means I can't "make" in the IDE. Is there a way to get IDEA to compile these correctly, or failing that, drop the error down to a warning?

like image 582
David Moles Avatar asked Sep 09 '11 18:09

David Moles


People also ask

How do I resolve an Unmappable character for encoding utf8?

"error: unmappable character for encoding UTF-8" means, java has found a character which is not representing in UTF-8. Hence open the file in an editor and set the character encoding to UTF-8. You should be able to find a character which is not represented in UTF-8. Take off this character and recompile.

How do I fix the Unmappable character for encoding cp1252?

Go to common tab of RUN/DEBUG configuration in eclipse change encoding to UTF-8. Show activity on this post. Window > Preferences > General > Content Types, set UTF-8 as the default encoding for all content types. Window > Preferences > General > Workspace, set "Text file encoding" to "Other : UTF-8".


2 Answers

I solved this issue adding this property in IntelliJ option panel Compiler/Java Compiler :

Additional command line parameters : -encoding ISO-8859-1

like image 150
obe6 Avatar answered Dec 28 '22 02:12

obe6


I have UTF-8 encoding in encoding.xml as follows, but still not working. keeps getting error "Error: java: error: unmappable character (0xFE) for encoding UTF-8"

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8">
    <file url="file://$PROJECT_DIR$" charset="UTF-8" />
    <file url="PROJECT" charset="UTF-8" />
  </component>
</project>
like image 29
chc Avatar answered Dec 28 '22 02:12

chc