APK errors

In Java the letter ə breaks for Excel

FileWriter writes the file with the system table. On Azerbaijani Windows that is often Cp1254. ə is not there, so the letter becomes ?.

Files.writeString writes UTF-8, but it does not put three bytes at the start. Excel can still open that file with the system table. ödəyici then looks like ödÉ™yici.

Put EF BB BF at the start. Do not write Cp1254.

import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;

byte[] bom = new byte[] {(byte) 0xEF, (byte) 0xBB, (byte) 0xBF};
byte[] metn = "ad\nAzərbaycan\n".getBytes(StandardCharsets.UTF_8);
byte[] fayl = new byte[bom.length + metn.length];
System.arraycopy(bom, 0, fayl, 0, bom.length);
System.arraycopy(metn, 0, fayl, bom.length, metn.length);
Files.write(Path.of("metn.csv"), fayl);