Inputstream, Can't read commas ' or quotes "" in android

Issue

I am trying to read a text file from raw folder, and it works perfectly except for one problem.

http://imageshack.us/photo/my-images/217/inputt.jpg/

as shown in the picture, the problem is for any quotes ” “, or Commas ‘ in the text file, it displays this question mark symbol instead.

code:

try {
        Resources res = getResources();
        InputStream in_s = res.openRawResource(R.raw.hr_consultant);

        byte[] b = new byte[in_s.available()];


        in_s.read(b);

        tv_data.setText(new String(b));
    } catch (Exception e) {
        // e.printStackTrace();
        tv_data.setText("Error: can't show help.");
    }

N.B: the text file in raw is referred as int value, so another Reader types may not work. so
any ideas?

Solution

I found a way to solve that thanks to God,
When you done with your text file;

  • Select File > Save As
  • Edit “Encoding” property to UTF-8

Answered By – Aziz

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published