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

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

commit b3b4b7298a96b8f2d2289595377960c7b00958f4
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 9a747ff3f2..8a50e60496 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 {
@@ -163,6 +165,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