title: How to obtain correct URI of a local file?
body: <p>To my great surprise, following snippet prints <code>false</code> on jdk1.8.0_u144</p>
  <pre><code>public class Tmp {
    public static void main(String[] args) {
      File f = new File(&quot;.&quot;);
      boolean result = f.toPath().toUri().toString().equals(f.toURI().toString());
      System.out.println(&quot;result = &quot; + result);
    }
  }
  </code></pre>
  <p>Obviously, <code>java.io.File#toURI</code> and <code>java.nio.Path#toUri</code> return different presentations. The question is, which of them is correct (according to <a href="https://www.rfc-editor.org/rfc/rfc8089" rel="nofollow noreferrer">RFC 8089</a>)?</p>