docs: public static String escapeToSoyString(
        String value, boolean shouldEscapeToAscii, QuoteStyle quoteStyle) {
  
      // StringUtil.javaScriptEscape() is meant to be compatible with JS string syntax, which is a
      // superset of the Soy expression string syntax, so we can't depend on it to properly escape a
      // Soy expression string literal. For example, they switched the default character escaping
      // to octal to save a few bytes, but octal escapes are not allowed in Soy syntax. I'm rewriting
      // the code here in a correct way for Soy.
  
      int len = value.length();
      StringBuilder out = new StringBuilder(len * 9 / 8);
      out.append(quoteStyle.getQuoteChar());
  
      int codePoint;
      for (int i = 0; i < len; i += Character.charCount(codePoint)) {
        codePoint = value.codePointAt(i);
  
        switch (codePoint) {
          case '\n':
            out.append("\\n");
            break;
          case '\r':
            out.append("\\r");
            break;
          case '\t':
            out.append("\\t");
            break;
          case '\b':
            out.append("\\b");
            break;
          case '\f':
            out.append("\\f");
            break;
          case '\\':
            out.append("\\\\");
            break;
          case '\'':
            out.append(quoteStyle == QuoteStyle.DOUBLE ? "'" : "\\'");
            break;
          case '"':
            out.append(quoteStyle == QuoteStyle.DOUBLE ? "\\\"" : '"');
            break;
          default:
            // If shouldEscapeToAscii, then hex escape characters outside the range 0x20 to 0x7F.
            if (shouldEscapeToAscii && (codePoint < 0x20 || codePoint >= 0x7F)) {
              appendHexEscape(out, codePoint);
            } else {
              out.appendCodePoint(codePoint);
            }
            break;
        }
      }
  
      out.append(quoteStyle.getQuoteChar());
      return out.toString();
    }