title: How do I read .txt assets as UTF-8 in Android through the assetManager?
body: <pre><code>private void copyMB() {
      AssetManager assetManager = this.getResources().getAssets();
      String[] files = null;
      try {
          files = assetManager.list(assetDir);
      } catch (Exception e) {
          e.printStackTrace();
      }
      for(int i=0; i&lt;files.length; i++) {
          InputStream in = null;
          FileOutputStream fos;
          try {
              in = assetManager.open(assetDir+"/" + files[i]);
  
              fos = openFileOutput(files[i], Context.MODE_PRIVATE);
              copyFile(in, fos);
              in.close();
              in = null;
              fos.flush();
              fos.close();
              fos = null;
          } catch(Exception e) {
              e.printStackTrace();
          }       
      }
  }
  private void copyFile(InputStream in, OutputStream out) throws IOException {
  
      byte[] buffer = new byte[1024];
      int read;
  
      while((read = in.read(buffer)) != -1){
          out.write(buffer, 0, read);
      }
  }
  </code></pre>
  
  <p>My problem is that UTF-8 character such as åäö is replaced by wierd looking characters. How can I make sure that it my InputStream reader uses UTF-8? In normal Java it would be easy Writing … new InputStreamReader(filePath, "UTF-8"); But since I am getting it from the Asset folder I canot do that (I have to use the assetManager.open() method which wont take "UTF-8" as an argument.</p>
  
  <p>Any ideas? :)</p>
  
  <p>Thank you for your help.</p>