1
1
/*
2
- * Copyright 2002-2017 the original author or authors.
2
+ * Copyright 2002-2019 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
19
19
import org .springframework .util .Assert ;
20
20
21
21
/**
22
- * Utility class for HTML escaping. Escapes and unescapes
23
- * based on the W3C HTML 4.01 recommendation, handling
22
+ * Utility class for HTML escaping.
23
+ *
24
+ * <p>Escapes and unescapes based on the W3C HTML 4.01 recommendation, handling
24
25
* character entity references.
25
26
*
26
27
* <p>Reference:
27
28
* <a href="http://www.w3.org/TR/html4/charset.html">http://www.w3.org/TR/html4/charset.html</a>
28
29
*
29
- * <p>For a comprehensive set of String escaping utilities,
30
- * consider Apache Commons Lang and its StringEscapeUtils class.
31
- * We are not using that class here to avoid a runtime dependency
32
- * on Commons Lang just for HTML escaping. Furthermore, Spring's
33
- * HTML escaping is more flexible and 100% HTML 4.0 compliant.
30
+ * <p>For a comprehensive set of String escaping utilities, consider
31
+ * <a href="https://commons.apache.org/proper/commons-text/"> Apache Commons Text</a>
32
+ * and its {@code StringEscapeUtils} class. We do not use that class here in order
33
+ * to avoid a runtime dependency on Commons Text just for HTML escaping. Furthermore,
34
+ * Spring's HTML escaping is more flexible and 100% HTML 4.0 compliant.
34
35
*
35
36
* @author Juergen Hoeller
36
37
* @author Martin Kersten
@@ -48,7 +49,7 @@ public abstract class HtmlUtils {
48
49
49
50
/**
50
51
* Turn special characters into HTML character references.
51
- * Handles complete character set defined in HTML 4.01 recommendation.
52
+ * <p> Handles complete character set defined in HTML 4.01 recommendation.
52
53
* <p>Escapes all special characters to their corresponding
53
54
* entity reference (e.g. {@code <}).
54
55
* <p>Reference:
@@ -64,7 +65,7 @@ public static String htmlEscape(String input) {
64
65
65
66
/**
66
67
* Turn special characters into HTML character references.
67
- * Handles complete character set defined in HTML 4.01 recommendation.
68
+ * <p> Handles complete character set defined in HTML 4.01 recommendation.
68
69
* <p>Escapes all special characters to their corresponding
69
70
* entity reference (e.g. {@code <}) at least as required by the
70
71
* specified encoding. In other words, if a special character does
@@ -97,7 +98,7 @@ public static String htmlEscape(String input, String encoding) {
97
98
98
99
/**
99
100
* Turn special characters into HTML character references.
100
- * Handles complete character set defined in HTML 4.01 recommendation.
101
+ * <p> Handles complete character set defined in HTML 4.01 recommendation.
101
102
* <p>Escapes all special characters to their corresponding numeric
102
103
* reference in decimal format (&#<i>Decimal</i>;).
103
104
* <p>Reference:
@@ -113,7 +114,7 @@ public static String htmlEscapeDecimal(String input) {
113
114
114
115
/**
115
116
* Turn special characters into HTML character references.
116
- * Handles complete character set defined in HTML 4.01 recommendation.
117
+ * <p> Handles complete character set defined in HTML 4.01 recommendation.
117
118
* <p>Escapes all special characters to their corresponding numeric
118
119
* reference in decimal format (&#<i>Decimal</i>;) at least as required by the
119
120
* specified encoding. In other words, if a special character does
@@ -147,7 +148,7 @@ public static String htmlEscapeDecimal(String input, String encoding) {
147
148
148
149
/**
149
150
* Turn special characters into HTML character references.
150
- * Handles complete character set defined in HTML 4.01 recommendation.
151
+ * <p> Handles complete character set defined in HTML 4.01 recommendation.
151
152
* <p>Escapes all special characters to their corresponding numeric
152
153
* reference in hex format (&#x<i>Hex</i>;).
153
154
* <p>Reference:
@@ -163,7 +164,7 @@ public static String htmlEscapeHex(String input) {
163
164
164
165
/**
165
166
* Turn special characters into HTML character references.
166
- * Handles complete character set defined in HTML 4.01 recommendation.
167
+ * <p> Handles complete character set defined in HTML 4.01 recommendation.
167
168
* <p>Escapes all special characters to their corresponding numeric
168
169
* reference in hex format (&#x<i>Hex</i>;) at least as required by the
169
170
* specified encoding. In other words, if a special character does
@@ -205,8 +206,8 @@ public static String htmlEscapeHex(String input, String encoding) {
205
206
* &#<i>Decimal</i>; - <i>(Example: &#68;)</i><br>
206
207
* &#x<i>Hex</i>; - <i>(Example: &#xE5;) case insensitive</i><br>
207
208
* </blockquote>
208
- * Gracefully handles malformed character references by copying original
209
- * characters as is when encountered.<p>
209
+ * <p> Gracefully handles malformed character references by copying original
210
+ * characters as is when encountered.
210
211
* <p>Reference:
211
212
* <a href="http://www.w3.org/TR/html4/sgml/entities.html">
212
213
* http://www.w3.org/TR/html4/sgml/entities.html
0 commit comments