private static @NotNull String encodeForGit(@NotNull String line) {
    StringBuilder encoded = new StringBuilder();
    line.chars().forEachOrdered(c -> encoded.append("%x").append(String.format("%02x", c)));
    return encoded.toString();
  }
private static @NotNull String encodeForGit(@NotNull String line)