title: How to get absolute path with proper character encoding in Java?
body: <p>I'd like to get the absolute path of a file, so that I can use it further to locate this file. I do it the following way:</p>
  
  <pre><code>File file = new File(Swagger2MarkupConverterTest.class.getResource(
              "/json/swagger.json").getFile());   
  String tempPath = file.getAbsolutePath();
  String path = tempPath.replace("\\", "\\\\");
  </code></pre>
  
  <p>The path irl looks like this:</p>
  
  <pre><code>C:\\Users\\Michał Szydłowski\\workspace2\\swagger2markup\\bin\\json\\swagger.json
  </code></pre>
  
  <p>However, since it contains Polish characters and spaces, what I get from <code>getAbsolutPath</code> is:</p>
  
  <pre><code>C:\\Users\\Micha%c5%82%20Szyd%c5%82owski\\workspace2\\swagger2markup\\bin\\json\\swagger.json
  </code></pre>
  
  <p>How can I get it to do it the right way? This is problematic, because with this path, it cannot locate the file (says it doesn't exist). </p>