Java read utf-8 encoded file, character by character
<p>I have a file saved as utf-8 (saved by my application in fact). How do you read it character by character?</p>

<pre><code>File file = new File(folder+name);
FileInputStream fis = new FileInputStream(file);
BufferedInputStream bis = new BufferedInputStream(fis);
DataInputStream dis = new DataInputStream(bis);
</code></pre>

<p>The two options seem to be:</p>

<pre><code>char c = dis.readByte()
char c = dis.readChar()
</code></pre>

<ul>
<li>The first option works as long as you only have ascii characters stored, ie english.</li>
<li>The second option reads the first and second byte of the file as one character.</li>
</ul>

<p>The original file is being written as follows:</p>

<pre><code>File file = File.createTempFile("file", "txt");
FileWriter fstream = new FileWriter(file);
BufferedWriter out = new BufferedWriter(fstream);
</code></pre>
