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