From c55277d689dee83f58f63f56a0e26debff62aa56 Mon Sep 17 00:00:00 2001 From: Raph Levien Date: Fri, 10 Jul 2015 17:11:39 -0700 Subject: Improve Html.toHtml() documentation The existing documentation is very terse and users were getting confused whether the method escapes HTML metacharacters or not. Expand the description a bit and explicitly state that metacharacters are escaped. Bug: 17456925 Change-Id: Icaae7fe1344629de5c0860674f3913781de18013 --- core/java/android/text/Html.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/java/android/text/Html.java b/core/java/android/text/Html.java index a55a08cc73e2..dc1d6f6229c1 100644 --- a/core/java/android/text/Html.java +++ b/core/java/android/text/Html.java @@ -137,7 +137,12 @@ public class Html { } /** - * Returns an HTML representation of the provided Spanned text. + * Returns an HTML representation of the provided Spanned text. A best effort is + * made to add HTML tags corresponding to spans. Also note that HTML metacharacters + * (such as "<" and "&") within the input text are escaped. + * + * @param text input text to convert + * @return string containing input converted to HTML */ public static String toHtml(Spanned text) { StringBuilder out = new StringBuilder(); -- cgit v1.2.3-59-g8ed1b