In my application are a bunch of message bundles as properties files. The messages are looked up in JSP files via <spring:message code="code.here">
. This works and all special characters are rendered as they should in the browser.
Now I needed to get some extra logic into one of the JSP files and added a servlet in its place that does its thing and renders the JSP with req.getRequestDispatcher("/jsp/some_file.jsp").include(req, resp);
.
This mostly works but now all special characters (German umlauts in my case) are broken. For some reason the umlauts that come out of the message tag are rendered incorrectly. By way of example the word "ungültig" comes out as
00000000 75 6e 67 ef bf bd 6c 74 69 67 0a |ung...ltig.|
in the browser. I know that this is a UTF-8 encoded Unicode replacement character but what I don't know is why it's there.
The resource files all have the correct encoding, in fact, to play it safe, our resource files are all ASCII and "ungültig" is in fact encoded as ung\u00FCltig
, where 0xFC is the encoding of ü in ISO-8859-1 which is by definition the required encoding for Java's properties files.
I have no idea why this happens. Why is it suddenly rendering incorrectly and how do I fix it?