Skip to content

Commit 58bd93d

Browse files
authored
Merge pull request #72 from meeque/issue/71-forHtmlAttribute-docs
Improve Encode.forHtmlAttribute docs
2 parents ad296f2 + 351e999 commit 58bd93d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/src/main/java/org/owasp/encoder/Encode.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ public static void forHtmlContent(Writer out, String input)
243243
*
244244
* <b>Example JSP Usage</b>
245245
* <pre>
246-
* &lt;div&gt;&lt;%=Encode.forHtmlAttribute(unsafeData)%&gt;&lt;/div&gt;
246+
* &lt;input value=&quot;&lt;%=Encode.forHtmlAttribute(unsafeData)%&gt;&quot; title=&#39;&lt;%=Encode.forHtmlAttribute(moreUnsafeData)%&gt;&#39; /&gt;
247247
* </pre>
248248
*
249249
* <table border="0" class="memberSummary" summary="Shows the input and results of encoding">
@@ -276,6 +276,8 @@ public static void forHtmlContent(Writer out, String input)
276276
*
277277
* <p><b>Additional Notes</b></p>
278278
* <ul>
279+
* <li>When using this method, the caller must provide quotes around the attribute value.</li>
280+
*
279281
* <li>Both the single-quote character ({@code '}) and the
280282
* double-quote character ({@code "}) are encoded so this is safe
281283
* for HTML attributes with either enclosing character.</li>

0 commit comments

Comments
 (0)