How to output UTF-8 In Console for Tomcat Webapps?

Answered

I need to output Japanese to the IntelliJ console for my webapp logging. When I run a junit test, the correct UTF-8 chars show up. While running inside of Tomcat in IntelliJ, the characters are messed up. How do I fix this?

I am running IDEA 10.0.3 with the settings File Encoding -> IDE Encoding set to UTF-8. I even put -Dfile.encoding=UTF-8 inside of the catalina.bat file and verified the encoding is UTF-8 with:

        System.out.println(System.getProperty("file.encoding") + ": é à ê");

but I get:
UTF-8: é à Ãª

instead.

What else can I set to make sure a Tomcat webapp displays UTF-8 in the IDEA console? Why does it work in a unit test but not a webapp?

Thanks.

0
4 comments

Try adding -Dfile.encoding=UTF-8 in Help | Edit Custom VM Options and restart IntelliJ IDEA.

3
Avatar
Permanently deleted user

I have this same problem in IDEA 12.0.2 and Tomcat 7.0.28. Did you find a solution?

Regards,
Daniel Serodio

0

The same problem under Windows 7 x64, Tomcat 9.010, Intellij 2017.3. Nothing helps for console at all. The web app works fine.

0

Please sign in to leave a comment.