Solution for "InvalidPathException: Malformed input" in Tomcat

  • Posted on: 3 December 2014
  • By: Zhijun Chen

Today I came across the following Java Exception within Tomcat Web Application:

"java.nio.file.InvalidPathException: Malformed input or input contains unmappable characters."

This is due to file system not able to handle special characters in a file name, e.g. Tromsø.png
The solution to this issue is actually quite simple. Set the system language to be UTF8 using the following code:

export LANG = en_US.UTF8

Then restart Tomcat. Now Tomcat should pick up the system property and set the file.encode to be UTF8.

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.