void (@NotNull PsiFile file, @NotNull ProblemsHolder holder) { if (file.getViewProvider().getBaseLanguage() != file.getLanguage()) { // don't warn multiple times on files which have multiple views like PHP and JSP return; } VirtualFile virtualFile = file.getVirtualFile(); byte[] bom = virtualFile == null ? null : virtualFile.getBOM(); if (bom != null) { String hex = IntStream.range(0, bom.length) .map(i -> bom[i]) .mapToObj(b -> StringUtil.toUpperCase(Integer.toString(b & 0x00ff, 16))) .collect(Collectors.joining()); Charset charsetFromBOM = CharsetToolkit.guessFromBOM(bom); final String signature = charsetFromBOM == null ? "" : CodeInsightBundle.message("non.ascii.chars.inspection.message.charset.signature", charsetFromBOM.displayName()); holder.registerProblem(file, CodeInsightBundle.message("non.ascii.chars.inspection.message.file.contains.bom", hex, signature)); } }