Charset (final @Nullable Project project, final @Nullable VirtualFile file, final @NotNull CharSequence content) { String name = XmlCharsetDetector.extractXmlEncodingFromProlog(content); Charset charset = CharsetToolkit.forName(name); if (charset != null) { return charset; } return HtmlUtil.detectCharsetFromMetaTag(content); }