Thomas Sundberg

February 17, 2011

Unmappable character for encoding UTF-8

Filed under: Java, Maven — Tags: , , , , , , — Thomas Sundberg @ 08:40

This post has been migrated to

We had a problem in my current Java project. Whenever somebody wrote a comment using Swedish national characters, åäö or ÅÄÖ, and later tried to build the system with Maven we got the error:

unmappable character for encoding UTF-8

We had set our Maven build to use UTF-8 and hoped that should be enough. It turns out that when using Intellij IDEA as IDE you need to change a setting on which character encoding that should be used when saving a file. The default setting is <System Default>. This is probably a good design choice from Jetbrains, but in our case it isn’t the best option.

To change this, go to Settings and File Encodings and set the property IDE Encoding to UTF-8. While you are there, take a look at the setting Autodetect UTF-encoded files and make sure that it is set.

This is of course obvious since Windows users normally don’t use UTF-8 by default, default is Cp1252, and in my case the default setting on my Mac is MacRoman. But never the less, it has to be set properly for every developer in the project.

All files has to be edited before the change will propagate to all files, but this is an active project so it will happen soon. Similar to fixing bad code into Clean Code, fix one thing at a time. It will eventually get better and finally god.


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at

%d bloggers like this: