Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ee4c8464 authored by Victoria Lease's avatar Victoria Lease Committed by Android (Google) Code Review
Browse files

Merge "Handle surrogate pairs in Html.toHtml()" into klp-dev

parents 4846a93b 3d476415
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -391,6 +391,15 @@ public class Html {
                out.append(">");
                out.append(">");
            } else if (c == '&') {
            } else if (c == '&') {
                out.append("&");
                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 < ' ') {
            } else if (c > 0x7E || c < ' ') {
                out.append("&#").append((int) c).append(";");
                out.append("&#").append((int) c).append(";");
            } else if (c == ' ') {
            } else if (c == ' ') {