Strange issue, Tomcat Webapp UTF-8 Symbol cannot display correctly after every restart or every redistribution

We have a weird web application problem for displaying UTF-8 characters correctly, here are the facts:

  • Tomcat 6.0.20 running on Ubuntu 9.04
  • We follow the advice here Get a job UTF-8
  • Our Webapp is able to correctly display the UTF-8 character.

However, whenever our developer redeploys our webapp module or when we restart tomcat, all UTF-8 characters are displayed as ????? in our browser.

We need to make a proper restart of Tomcat (wait for Tomcat to stop completely and restart tomcat again), although this is annoying, it does solve the problem.

Has anyone encountered a similar problem before, thanks for the tips.

+3
source share
2 answers

If you are sure that this is UTF-8, this may work. Install this line in the catalina.sh file (for example, immediately after a huge source comment, long before they are exported):

export CATALINA_OPTS="$CATALINA_OPTS -Dfile.encoding=UTF-8"

In addition, we do not know if you are using data from a database. Check if you placed it correctly.

+12
source

Thus, the encoding of the JSP page went crazy. If you followed the article you found correctly, then this implicitly means that

<%@page pageEncoding="UTF-8" %>

has broken.

- JSP , . , .java appserver try:

response.setContentType("text/html;charset=UTF-8");

- . -, . Firefox > . UTF-8. Firefox View > Character Encoding.

, .

: , Ubuntu GNU JDK/JRE. Sun JDK/JRE. , "" /, JDK/JRE .

0

Source: https://habr.com/ru/post/1726207/


All Articles