T
T
tenset2014-04-20 13:44:00
Java
tenset, 2014-04-20 13:44:00

Why are abracadabra printed?

Began to master work with files (Java). The program reads a file that contains Russian characters and displays some of them on the screen. Everything works correctly in NetBeans IDE , but the jar version of the program outputs this .
File Read Code

try {
             String s="";
             FileReader fr = new FileReader(flt.getAbsolutePath());
             BufferedReader br = new BufferedReader(
                                new InputStreamReader(
                                    new FileInputStream(flt.getAbsolutePath())));
             
                String str = br.readLine();
                String result = "";

                while (str != null) {
                    result +=str+"\n";
                    str = br.readLine();
                    s=result;
             }
}
            catch (IOException e1) {
                }

Further we work with s

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
tenset, 2014-04-20
@tenset

After replacing BufferedReader, the problem was solved

BufferedReader br = new BufferedReader (
            new InputStreamReader(
                new FileInputStream( flt ), "UTF-8">

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question