I have this method reading the file:
private String fileContent = ""; void writeFile(String path) { try (FileInputStream input = new FileInputStream(path)) { int stream = input.read(); while (stream != -1) { this.fileContent = String.format("%s%s", this.fileContent, ((char)stream)); stream = input.read(); } } catch (IOException e) { e.printStackTrace(); } } When I read the English alphabet from a file, everything is ok. But when I try to count Cyrillic, hieroglyphs are obtained. Although in the file from which I read the UTF-8 encoding and in the development environment I have UTF-8. Tell me how to fix it?