myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r1532837 - /myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoder.java
Date Wed, 16 Oct 2013 17:59:57 GMT
Author: lu4242
Date: Wed Oct 16 17:59:57 2013
New Revision: 1532837

URL: http://svn.apache.org/r1532837
Log:
MYFACES-3744 Vertical tab character (\u000B) destroys AJAX-response

Modified:
    myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoder.java

Modified: myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoder.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoder.java?rev=1532837&r1=1532836&r2=1532837&view=diff
==============================================================================
--- myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoder.java
(original)
+++ myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoder.java
Wed Oct 16 17:59:57 2013
@@ -103,6 +103,14 @@ public abstract class HTMLEncoder
                     default:
                         break;
                 }
+                // http://www.w3.org/MarkUp/html3/specialchars.html
+                // From C0 extension U+0000-U+001F only U+0009, U+000A and
+                // U+000D are valid control characters
+                if (c <= 0x1F && c != 0x09 && c != 0x0A && c !=
0x0D)
+                {
+                    // Ignore escape character
+                    app = "";
+                }
             }
             else if (encodeNonLatin && (int)c > 0x80)
             {
@@ -226,6 +234,14 @@ public abstract class HTMLEncoder
                     default:
                         break;
                 }
+                // http://www.w3.org/MarkUp/html3/specialchars.html
+                // From C0 extension U+0000-U+001F only U+0009, U+000A and
+                // U+000D are valid control characters
+                if (c <= 0x1F && c != 0x09 && c != 0x0A && c !=
0x0D)
+                {
+                    // Ignore escape character
+                    app = "";
+                }
             }
             else if (encodeNonLatin && (int)c > 0x80)
             {
@@ -377,6 +393,14 @@ public abstract class HTMLEncoder
                     default:
                         break;
                 }
+                // http://www.w3.org/MarkUp/html3/specialchars.html
+                // From C0 extension U+0000-U+001F only U+0009, U+000A and
+                // U+000D are valid control characters
+                if (c <= 0x1F && c != 0x09 && c != 0x0A && c !=
0x0D)
+                {
+                    // Ignore escape character
+                    app = "";
+                }
             }
             else if (encodeNonLatin && (int)c > 0x80)
             {
@@ -612,8 +636,8 @@ public abstract class HTMLEncoder
                 {
                     char c1 = string.charAt(i+1);
                     char c2 = string.charAt(i+2);
-                    if ((( c1 >= '0' && c1 <='9') || (c1 >='A' &&
c1 <='Z')) &&
-                        (( c2 >= '0' && c2 <='9') || (c2 >='A' &&
c2 <='Z')))
+                    if ((( c1 >= '0' && c1 <='9') || (c1 >='A' &&
c1 <='Z') || (c1 >='a' && c1 <='z')) &&
+                        (( c2 >= '0' && c2 <='9') || (c2 >='A' &&
c2 <='Z') || (c2 >='a' && c2 <='z')))
                     {
                         // do not percent encode, because it could be already encoded
                         // and we don't want encode it twice
@@ -771,8 +795,8 @@ public abstract class HTMLEncoder
                 {
                     char c1 = string.charAt(i+1);
                     char c2 = string.charAt(i+2);
-                    if ((( c1 >= '0' && c1 <='9') || (c1 >='A' &&
c1 <='Z')) &&
-                        (( c2 >= '0' && c2 <='9') || (c2 >='A' &&
c2 <='Z')))
+                    if ((( c1 >= '0' && c1 <='9') || (c1 >='A' &&
c1 <='Z') || (c1 >='a' && c1 <='z')) &&
+                        (( c2 >= '0' && c2 <='9') || (c2 >='A' &&
c2 <='Z') || (c2 >='a' && c2 <='z')))
                     {
                         // do not percent encode, because it could be already encoded
                     }
@@ -1010,8 +1034,8 @@ public abstract class HTMLEncoder
                 {
                     char c1 = string.charAt(i+1);
                     char c2 = string.charAt(i+2);
-                    if ((( c1 >= '0' && c1 <='9') || (c1 >='A' &&
c1 <='Z')) &&
-                        (( c2 >= '0' && c2 <='9') || (c2 >='A' &&
c2 <='Z')))
+                    if ((( c1 >= '0' && c1 <='9') || (c1 >='A' &&
c1 <='Z') || (c1 >='a' && c1 <='z')) &&
+                        (( c2 >= '0' && c2 <='9') || (c2 >='A' &&
c2 <='Z') || (c2 >='a' && c2 <='z')))
                     {
                         // do not percent encode, because it could be already encoded
                         // and we don't want encode it twice
@@ -1221,8 +1245,8 @@ public abstract class HTMLEncoder
                 {
                     char c1 = string.charAt(i+1);
                     char c2 = string.charAt(i+2);
-                    if ((( c1 >= '0' && c1 <='9') || (c1 >='A' &&
c1 <='Z')) &&
-                        (( c2 >= '0' && c2 <='9') || (c2 >='A' &&
c2 <='Z')))
+                    if ((( c1 >= '0' && c1 <='9') || (c1 >='A' &&
c1 <='Z') || (c1 >='a' && c1 <='z')) &&
+                        (( c2 >= '0' && c2 <='9') || (c2 >='A' &&
c2 <='Z') || (c2 >='a' && c2 <='z')))
                     {
                         // do not percent encode, because it could be already encoded
                     }



Mime
View raw message