Bug 64000

Summary: Localization of examples web application is broken because of ISO-8859-1
Product: Tomcat 7 Reporter: Konstantin Kolinko <knst.kolinko>
Component: ExamplesAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: minor    
Priority: P2    
Version: trunk   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description Konstantin Kolinko 2019-12-12 09:33:21 UTC
The following issue was noted when testing Tomcat 7.0.99 (release candidate) running on a Russian version of Windows:

The title of RequestParamExample page displays "?????..." instead of readable text.

Affected page:
http://localhost:8080/examples/servlets/servlet/RequestParamExample


Quick notes:
------------

1. As displayed by "Network" tab in Developer tools in Firefox, the server sends the following Content-Type header for this page:

Content-Type: text/html;charset=ISO-8859-1

Apparently the examples web application in Tomcat 7 has not been converted to use UTF-8 yet, unlike the one in Tomcat 8.5+.

2. I cannot test the issue via configuration of language preferences in my browser. Apparently the localization relies on the system locale.

It would be better to respect the client's language preferences.


Steps to reproduce:
------------

1. Use an OS that uses Russian or Japanese locale, if possible. Otherwise add the following line to bin/setenv.bat file in Tomcat.

set "JAVA_OPTS=-Duser.language=ru"

or with Japanese language (ja).

2. Start Tomcat with bin/startup.bat.

3. Open the following page in a browser:
Examples > Servlets examples > Request Parameters
http://localhost:8080/examples/servlets/servlet/RequestParamExample

4. Actual behavior:
The title of the page displays the following string of question marks instead of a readable text:
"?????? ?????????? ???????"

The source code of "webapps\examples\WEB-INF\classes\RequestParamExample.java" shows that the page title is localized:

> String title = RB.getString("requestparams.title");

Looking into localization files (LocalStrings_ru.properties in the same directory as the java file) the "requestparams.title" message is the only one localized here. For Japanese language there are a lot of other localized messages and it is more easy to notice the issue.
Comment 1 Mark Thomas 2020-01-14 20:11:56 UTC
Fixed in:
- master for 10.0.0.0-M1 onwards
- 9.0.x for 9.0.31 onwards
- 8.5.x for 8.5.51 onwards
- 7.0.x for 7.0.100 onwards