Problems with directory accents

0

I need to get the directory of a file that is inside the project, but the return is not respecting the folder accents.

Class searching directory:

package NewClass;

import java.io.File;

public class NewMain1 {

public static void main(String[] args) {
    File root = (new File(NewMain1.class.getResource("teste.txt").getFile())).getParentFile().getParentFile();
    System.out.println(root);
    File file1 = new File(root + "\teste.txt");
    System.out.println(file1);
}    
}

The path is: "C: \ Users \ Administrator \ Desktop \ Peter \ Applications \ JavaApplication1 \ build \ classes".

But the output comes: "C: \ Users \ Administrator \ Desktop \ Pedro \ Applies% c3% a7% c3% b5es \ JavaApplication1 \ build \ classes".

    
asked by anonymous 26.06.2018 / 21:37

0 answers