code: public static String unescapeLeniently(String s) {
          StringBuilder buf = new StringBuilder();
          int[] pos = new int[1];
          for (int i=0; i<s.length(); ) {
              char c = s.charAt(i++);
              if (c == '\\') {
                  pos[0] = i;
                  int e = unescapeAt(s, pos);
                  if (e < 0) {
                      buf.append(c);
                  } else {
                      buf.appendCodePoint(e);
                      i = pos[0];
                  }
              } else {
                  buf.append(c);
              }
          }
          return buf.toString();
      }
docs: Convert all escapes in a given string using unescapeAt().
  Leave invalid escape sequences unchanged.