code: private static <T extends Appendable> T _appendToPat(T buf, String s, boolean escapeUnprintable) {
          int cp;
          for (int i = 0; i < s.length(); i += Character.charCount(cp)) {
              cp = s.codePointAt(i);
              _appendToPat(buf, cp, escapeUnprintable);
          }
          return buf;
      }
docs: Append the <code>toPattern()</code> representation of a
  string to the given <code>Appendable</code>.