This is an automated email from the ASF dual-hosted git repository.

markt-asf pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
     new 307be6bf07 Follow-up to "Ignore a null charset in the 
AddDefaultCharsetFilter..."
307be6bf07 is described below

commit 307be6bf079e10d25aaf40e3ddc0cae86ec5a213
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]

Reply via email to