Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Tomcat locale mapping for Japanese to preserve UTF-8 charset #30535

Closed

Conversation

chrisrhut
Copy link
Contributor

@chrisrhut chrisrhut commented Apr 5, 2022

Tomcat 9.0.59 added a charset mapping for Japanese to default to Shift_JIS encoding.

This results in corrupted rendering if the client expects UTF-8 and can be easily seen by setting the Accept-Language: ja header (by changing the primary language in Chrome settings to Japanese).

The fix is to apply the same override mapping in TomcatServletWebServerFactory.java that already existed for en and fr (in those cases, to override ISO-8559-1 to UTF-8):

index.html:

<!DOCTYPE html>
<html lang="ja">
<head>
  <meta charset="UTF-8">
  <title>こんにちは世界</title> <!-- "Hello, World" -->
</head>
<body>
管理者画面 <!-- "Admin" -->
</body>
</html>

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 5, 2022
@snicoll
Copy link
Member

snicoll commented Apr 5, 2022

@chrisrhut thank you for the PR. I've removed the screenshots as I believe they're adding noise to the report.

@mhalbritter mhalbritter self-assigned this Apr 5, 2022
@mhalbritter mhalbritter added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 5, 2022
@mhalbritter mhalbritter added this to the 2.5.x milestone Apr 5, 2022
@mhalbritter mhalbritter modified the milestones: 2.5.x, 2.5.13 Apr 5, 2022
@mhalbritter mhalbritter changed the title add Tomcat locale mapping for Japanese to preserve UTF-8 charset Add Tomcat locale mapping for Japanese to preserve UTF-8 charset Apr 5, 2022
@mhalbritter
Copy link
Contributor

Thanks for your contribution, i merged it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants