Merge "Handle surrogate pairs in Html.toHtml()" into klp-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
ee4c84642a
@@ -391,6 +391,15 @@ public class Html {
|
||||
out.append(">");
|
||||
} else if (c == '&') {
|
||||
out.append("&");
|
||||
} else if (c >= 0xD800 && c <= 0xDFFF) {
|
||||
if (c < 0xDC00 && i + 1 < end) {
|
||||
char d = text.charAt(i + 1);
|
||||
if (d >= 0xDC00 && d <= 0xDFFF) {
|
||||
i++;
|
||||
int codepoint = 0x010000 | (int) c - 0xD800 << 10 | (int) d - 0xDC00;
|
||||
out.append("&#").append(codepoint).append(";");
|
||||
}
|
||||
}
|
||||
} else if (c > 0x7E || c < ' ') {
|
||||
out.append("&#").append((int) c).append(";");
|
||||
} else if (c == ' ') {
|
||||
|
||||
Reference in New Issue
Block a user