This is an automated email from the ASF dual-hosted git repository.
rmaucher pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push:
new 5446f0700c Skip BOM when serving UTF-32 files
5446f0700c is described below
commit 5446f0700c36306b03b9fb928ec412d7c0095bb4
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 7e9bc6a168..4ed182411c 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -1336,9 +1336,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 a762136a1c..6197d7397b 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -183,6 +183,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]