sS htmlencode_noQuotes(S s) {
if (s == null) ret "";
int n = s.length();
int i = 0;
StringBuilder out = null;
macro builder {
out if null = new StringBuilder(Math.max(16, n))).append(takeFirst(i, s));
out
}
for (int i = 0; i < n; i++) {
char c = s.charAt(i);
if (c == '<') {
builder.append("<");
}
else if (c == '>') {
builder.append(">");
}
else if (c > 127 || c == '&') {
int cp = s.codePointAt(i);
builder.append("");
out.append(intToHex_flexLength(cp));
out.append(';');
i += Character.charCount(cp)-1;
} else
out?.append(c);
}
ret out == null ? s : .toString();
}