title: How to handle special characters in json string
body: <p>I have an app where I store user entered text into a json string. I then store that json string into a file. And then later on display it back by reading the file, extracting the json string from it and finally getting the string to display into a textview. I am however noticing that any special characters(rather symbols) like £, ÷, € etc are not displayed back. For example the symbol € gets displayed as â□¬.</p>
  
  <p>Some sample code below for reference</p>
  
  <p>First the code for capturing user entered text and putting it into a file</p>
  
  <pre><code>//get user entered text
  QuestionEditText = (EditText)this.findViewById(R.id.editTextQuestion);
  //put that into json object
  JSONObject jObjOneQuestionDetails=new JSONObject();
  jObjOneQuestionDetails.put("Question", QuestionEditText.getText());
  //write json object  into file
  FileOutputStream output = openFileOutput("MyFileName",MODE_PRIVATE);
  OutputStreamWriter writer = new OutputStreamWriter(output);
  writer.writejObjOneQuestionDetails.put());
  writer.flush();
  writer.close();
  </code></pre>
  
  <p>Now below the code for getting the string back from file and displaying it to user</p>
  
  <pre><code>//define and initialize variables
  QuestionEditText = (EditText)this.findViewById(R.id.editTextQuestion);
  private JSONArray jArrayQuizQuestions=new JSONArray();
  private JSONObject jObjQuizTitle=new JSONObject();
  
  //load JSONObject with the File
  int ch;
  StringBuffer fileContent = new StringBuffer("");
  FileInputStream fis;
  String fileString;
  fis = this.getBaseContext().openFileInput("MyFileName");
  while( (ch = fis.read()) != -1)
            fileContent.append((char)ch);
  fileString = new String(fileContent);
  jObjQuizTitle = new JSONObject(fileString);
  jArrayQuizQuestions = jObjQuizTitle.getJSONArray("MyFileName");
  
  
  //display json object into textview
  JSONObject aQues = jArrayQuizQuestions.getJSONObject(pageNumber-1);
  String quesValue = aQues.getString("Question");
  QuestionEditText.setText(quesValue.toCharArray(), 0, quesValue.length());       
  </code></pre>
  
  <p>The code above is just a sample, I have ignored any try/catch blocks here. This should give an idea about how I am capturing and displaying the user entered text.</p>