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 629d557f6b Fix failing test on platforms that don't default to UTF-8
629d557f6b is described below

commit 629d557f6bf26113e02f8fa63fdc7d9440845811
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Nov 9 14:05:30 2026 +0000

    Fix failing test on platforms that don't default to UTF-8
---
 test/org/apache/jasper/servlet/TestJspCServletContext.java | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/test/org/apache/jasper/servlet/TestJspCServletContext.java 
b/test/org/apache/jasper/servlet/TestJspCServletContext.java
index b3bc93cdef..959de164fe 100644
--- a/test/org/apache/jasper/servlet/TestJspCServletContext.java
+++ b/test/org/apache/jasper/servlet/TestJspCServletContext.java
@@ -20,6 +20,7 @@ import java.io.File;
 import java.io.InputStream;
 import java.net.JarURLConnection;
 import java.net.URL;
+import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.util.Collection;
@@ -33,6 +34,7 @@ import jakarta.servlet.descriptor.JspConfigDescriptor;
 import jakarta.servlet.descriptor.JspPropertyGroupDescriptor;
 
 import org.junit.Assert;
+import org.junit.Assume;
 import org.junit.Test;
 
 public class TestJspCServletContext {
@@ -173,6 +175,14 @@ public class TestJspCServletContext {
 
     @Test
     public void testGetResourceWithUriIllegalCharacters() throws Exception {
+        // This is an undocumented property so treat with caution.
+        String fileSystemPathEncoding = System.getProperty("sun.jnu.encoding");
+        System.out.println(fileSystemPathEncoding);
+        if (fileSystemPathEncoding != null) {
+            Charset fileSystemPathCharset = 
Charset.forName(fileSystemPathEncoding);
+            Assume.assumeTrue("File system path encoding can't encode \u00fc. 
Consider using UTF-8.",
+                    fileSystemPathCharset.newEncoder().canEncode('\u00fc'));
+        }
         // A resource path is a decoded logical path. Resources whose name
         // contains characters that are not permitted in a URI, for example a
         // space or a non-ASCII character, resolve correctly at runtime so


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to