java.lang.IllegalArgumentException: The Unicode character [デ] at code point [12,487] cannot be encoded as it is outside the permitted range of 0 to 255

The cause is that you’re trying to set a HTTP header in Tomcat that contains non-ASCII characters (e.g. the Location header as part of a redirect or the Content-Disposition header for a file download). This has started appearing since switching to a new Tomcat version (9.0.73 at least has this issue).

The solution is to properly encode the HTTP headers. We’re doing this with

name = URLEncoder.encode(name, 'UTF-8')

For more in-depth information see these two bug reports


The stack location at which this occurred for us is

at org.apache.tomcat.util.buf.MessageBytes.toBytesSimple(
at org.apache.tomcat.util.buf.MessageBytes.toBytes(
at org.apache.coyote.ajp.AjpMessage.appendBytes(
at org.apache.coyote.ajp.AjpProcessor.prepareResponse(
This entry was posted in Software. Bookmark the permalink.