docs: static String escapeUnicodeFormatChars(String str) {
  
      int len = str.length();
  
      // Do a quick check first, because most strings do not contain Unicode format characters.
      boolean hasFormatChar = false;
      for (int i = 0; i < len; i++) {
        if (Character.getType(str.charAt(i)) == Character.FORMAT) {
          hasFormatChar = true;
          break;
        }
      }
      if (!hasFormatChar) {
        return str;
      }
  
      // Now we actually need to build a new string.
      StringBuilder out = new StringBuilder(len * 4 / 3);
      int codePoint;
      for (int i = 0; i < len; i += Character.charCount(codePoint)) {
        codePoint = str.codePointAt(i);
        if (Character.getType(codePoint) == Character.FORMAT) {
          BaseUtils.appendHexEscape(out, codePoint);
        } else {
          out.appendCodePoint(codePoint);
        }
      }
      return out.toString();
    }