You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by fs...@apache.org on 2019/06/22 10:13:44 UTC

[tomcat] branch master updated: Fix charset name for UTF-32LE in bom detection.

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

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
     new d328560  Fix charset name for UTF-32LE in bom detection.
d328560 is described below

commit d32856033bf762b63f95e82209ec92156d16d351
Author: zhanhb <63...@users.noreply.github.com>
AuthorDate: Fri Jun 21 20:42:45 2019 +0800

    Fix charset name for UTF-32LE in bom detection.
    
    Patch by zhanhb vi Github. Closes #173 on Github
---
 java/org/apache/catalina/servlets/DefaultServlet.java | 6 +++---
 webapps/docs/changelog.xml                            | 3 +++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java b/java/org/apache/catalina/servlets/DefaultServlet.java
index 1060b9b..a9ba7b6 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -1214,7 +1214,7 @@ public class DefaultServlet extends HttpServlet {
             return StandardCharsets.UTF_16BE;
         }
         // Delay the UTF_16LE check if there are more that 2 bytes since it
-        // overlaps with UTF32-LE.
+        // overlaps with UTF-32LE.
         if (count == 2 && b0 == 0xFF && b1 == 0xFE) {
             skip(is, 2);
             return StandardCharsets.UTF_16LE;
@@ -1241,10 +1241,10 @@ public class DefaultServlet extends HttpServlet {
         // Look for 4-byte BOMs
         int b3 = bom[3] & 0xFF;
         if (b0 == 0x00 && b1 == 0x00 && b2 == 0xFE && b3 == 0xFF) {
-            return Charset.forName("UTF32-BE");
+            return Charset.forName("UTF-32BE");
         }
         if (b0 == 0xFF && b1 == 0xFE && b2 == 0x00 && b3 == 0x00) {
-            return Charset.forName("UTF32-LE");
+            return Charset.forName("UTF-32LE");
         }
 
         // Now we can check for UTF16-LE. There is an assumption here that we
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 243b3b9..d1d9477 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -56,6 +56,9 @@
         <bug>63523</bug>: Restore SSLUtilBase methods as protected to preserve
         compatibility. (remm)
       </fix>
+      <fix>Fix typo in UTF-32LE charset name. Patch by zhanhb vi Github.
+        (fschumacher)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Jasper">


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org