public static @NotNull Charset extractCharsetFromFileContent(@Nullable Project project, @NotNull VirtualFile virtualFile, @NotNull CharSequence text) {
    Charset value = charsetFromContentOrNull(project, virtualFile, text);
    return value == null ? virtualFile.getCharset() : value;
  }
public static @NotNull Charset extractCharsetFromFileContent(@Nullable Project project, @NotNull VirtualFile virtualFile, @NotNull CharSequence text)