Charset (final Project project, final @Nullable VirtualFile file, final @NotNull CharSequence content) { String name = XmlCharsetDetector.extractXmlEncodingFromProlog(content); Charset charset = CharsetToolkit.forName(name); return charset == null ? StandardCharsets.UTF_8 : charset; }