This is an automated email from the ASF dual-hosted git repository.
markt-asf 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 8778a73d47 Follow-up to "Ignore a null charset in the
AddDefaultCharsetFilter..."
8778a73d47 is described below
commit 8778a73d47f3fd61736196aafb7e87f6497d6077
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Oct 1 16:06:25 2026 +0100
Follow-up to "Ignore a null charset in the AddDefaultCharsetFilter..."
- Reset the encoding to the default if the application clears any
explicit value.
- Handle the Charset setter
---
.../apache/catalina/filters/AddDefaultCharsetFilter.java | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/java/org/apache/catalina/filters/AddDefaultCharsetFilter.java
b/java/org/apache/catalina/filters/AddDefaultCharsetFilter.java
index 3e7a3e58b1..aa7b5b170f 100644
--- a/java/org/apache/catalina/filters/AddDefaultCharsetFilter.java
+++ b/java/org/apache/catalina/filters/AddDefaultCharsetFilter.java
@@ -152,9 +152,21 @@ public class AddDefaultCharsetFilter extends FilterBase {
@Override
public void setCharacterEncoding(String charset) {
super.setCharacterEncoding(charset);
- if (charset != null) {
+ if (charset == null) {
+ encoding = DEFAULT_ENCODING;
+ } else {
encoding = charset;
}
}
+
+ @Override
+ public void setCharacterEncoding(Charset encoding) {
+ super.setCharacterEncoding(encoding);
+ if (encoding == null) {
+ this.encoding = DEFAULT_ENCODING;
+ } else {
+ this.encoding = encoding.name();
+ }
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]