String (final @NotNull VirtualFile file, final byte @NotNull [] content) { LoadTextUtil.DetectResult guessed = LoadTextUtil.guessFromContent(file, content); String charset = guessed.hardCodedCharset != null ? guessed.hardCodedCharset.name() : XmlCharsetDetector.extractXmlEncodingFromProlog(content); if (charset != null) return charset; @NonNls String strContent = new String(content, StandardCharsets.ISO_8859_1); Charset c = HtmlUtil.detectCharsetFromMetaTag(strContent); return c == null ? null : c.name(); }