This is an automated email from the ASF dual-hosted git repository.
rmaucher pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push:
new a4f6d0a04c Skip BOM when serving UTF-32 files
a4f6d0a04c is described below
commit a4f6d0a04ccf9142d8a21d3bf4fbfeccf9c7d70b
Author: remm <[email protected]>
AuthorDate: Mon May 25 21:04:32 2026 +0200
Skip BOM when serving UTF-32 files
---
java/org/apache/catalina/servlets/DefaultServlet.java | 2 ++
webapps/docs/changelog.xml | 3 +++
2 files changed, 5 insertions(+)
diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java
b/java/org/apache/catalina/servlets/DefaultServlet.java
index 993572a63d..5d88fc2a82 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -1328,9 +1328,11 @@ public class DefaultServlet extends HttpServlet {
// Look for 4-byte BOMs
int b3 = bom[3] & 0xFF;
if (b0 == 0x00 && b1 == 0x00 && b2 == 0xFE && b3 == 0xFF) {
+ skip(is, 4, stripBom);
return Charset.forName("UTF-32BE");
}
if (b0 == 0xFF && b1 == 0xFE && b2 == 0x00 && b3 == 0x00) {
+ skip(is, 4, stripBom);
return Charset.forName("UTF-32LE");
}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index c8b38fe3e3..17041f81ad 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -187,6 +187,9 @@
Inaccurate session exipration statistics when using the persistent
manager. (remm)
</fix>
+ <fix>
+ Skip BOM when serving files with UTF-32 encoding. (remm)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]