Charset (@Nullable Project project, @NotNull DocumentContent content) { Charset charset = content.getCharset(); if (charset != null) return charset; EncodingManager e = project != null ? EncodingProjectManager.getInstance(project) : EncodingManager.getInstance(); return e.getDefaultCharset(); }