title: How to display Telugu data retrieved from API into Spinner using kotlin?
body: <p>I need to display the Telugu texts of Districts retrieved from API into Spinner, but random characters are displayed instead. How do I convert these characters to Telugu readable texts?</p>
  <p>Sample Codes:</p>
  <p>class MainActivity : AppCompatActivity() {
  lateinit var spDistrict: Spinner</p>
  <pre><code>override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      setContentView(R.layout.activity_main)
      
      districtData = mutableListOf()
      spDistrict = findViewById&lt;Spinner&gt;(R.id.district)
      getDistrictData()
  
      val jsonObject = JSONObject()
      jsonObject.put(&quot;profile_pic&quot;, userImage.toString().replace(&quot;/storage/emulated/0/Pictures/&quot;,&quot;&quot;))
      jsonObject.put(&quot;district_id&quot;, districtData!![spDistrict.selectedItemPosition].id)
      jsonObject.put(&quot;token&quot;, token)
  
  
      Log.e(&quot;jsonObject&quot;, jsonObject.toString())
      val url = Constant.BASE_URL + &quot;register/&quot;
      Log.e(&quot;url&quot;, &quot;----&gt;$url&quot;)
  
      val request = object : StringRequest(
      Method.POST, url, Response.Listener { response -&gt;
          try {
                   val responseObj = JSONObject(response)
                   if (response.isNotEmpty()) {
                       next.hideProgress(&quot;నమోదు&quot;)
  
                       val status = responseObj.getString(&quot;status&quot;)
                       if (status == &quot;success&quot; &amp;&amp; lang==&quot;telugu&quot;) {
                              val message = responseObj.getString(&quot;response&quot;)
                              val token = responseObj.getString(&quot;token&quot;)
                              val prefs = SharedPrefs(this@TReg3)
                              prefs.token = (token)
                              if (userImage.isNotEmpty()) {
                                  fileUpload()
  
                              } else {
                                  showSuccessDialog(message)
                                  dialog.dismiss()
                              }
  
                              } else {
                                  next.hideProgress(&quot;నమోదు&quot;)
                                  val message = responseObj.getString(&quot;response&quot;)
                                  showCustomAlertDialog(message)
                                  dialog.dismiss()
                              }
  
                           } else {
                          next.hideProgress(&quot;నమోదు&quot;)
                          showCustomAlertDialog(&quot;Something went wrong&quot;)
                          dialog.dismiss()
  
                      }
                  } catch (ex: Exception) {
                      next.hideProgress(&quot;నమోదు&quot;)
                      showCustomAlertDialog(&quot;Something went wrong&quot;)
                      dialog.dismiss()
                  }
              },
              Response.ErrorListener { error -&gt;
                  next.hideProgress(&quot;ప్రవేశించండి&quot;)
                  val errorMessage = VolleyErrorParser.getVolleyErrorMessage(error)
                  showCustomAlertDialog(errorMessage)
                  dialog.dismiss()
  
              }) {
              override fun getHeaders(): MutableMap&lt;String, String&gt; {
                  val params = java.util.HashMap&lt;String, String&gt;()
                  params[&quot;Content-Type&quot;] = &quot;application/json&quot;
                  return params
              }
  
              override fun getBody(): ByteArray {
                  return jsonObject.toString().toByteArray()
              }
          }
          MySingleton.getInstance(this).addToRequestQueue(request)
  
  
      }
  
  
  }
  
  private fun getDistrictData() {
      val url = Constant.BASE_URL + &quot;getDistricts/&quot;
      Log.e(&quot;districteUrl&quot;, url)
  
      val request = StringRequest(Request.Method.GET, url, { response -&gt;
          try {
  
              if (!response.isNullOrEmpty()) {
  
                  val jsonObject = JSONObject(response)
                  val status = jsonObject.getString(&quot;status&quot;)
  
                  if (status == &quot;success&quot;) {
                      val data = jsonObject.getJSONArray(&quot;districts&quot;)
  
                      districtData = listOf(
                          *Gson().fromJson(
                              data.toString(),
                              Array&lt;DistrictData&gt;::class.java
                          )
                      )
  
                      if (districtData!!.isNotEmpty()) {
                          val categoryDataAdapter = ArrayAdapter&lt;DistrictData&gt;(
                              this,
                              android.R.layout.simple_list_item_1,
                              districtData!!)
  
  
                          categoryDataAdapter.setDropDownViewResource(android.R.layout.simple_list_item_1)
                          spDistrict.adapter = categoryDataAdapter
                          // getMandalData()
  
                      } else {
                          dialog.dismiss()
                          val response = jsonObject.getString(&quot;response&quot;)
                          Toast.makeText(this, response, Toast.LENGTH_SHORT).show()
                      }
                  } else {
                      dialog.dismiss()
                      val response = jsonObject.getString(&quot;response&quot;)
                      Toast.makeText(this, response, Toast.LENGTH_SHORT).show()
                  }
  
  
              } else {
                  dialog.dismiss()
                  Toast.makeText(this, &quot;Something Went Wrong&quot;, Toast.LENGTH_SHORT).show()
              }
          } catch (ex: Exception) {
              Toast.makeText(this, &quot;Something Went Wrong&quot;, Toast.LENGTH_SHORT).show()
              dialog.dismiss()
              ex.printStackTrace()
          }
      }, { error -&gt;
          dialog.dismiss()
          val errorMessage = VolleyErrorParser.getVolleyErrorMessage(error)
          Toast.makeText(this, errorMessage, Toast.LENGTH_SHORT).show()
  
  
      })
      VolleySingleton.getInstance(this!!).addToRequestQueue(request)
  }
  </code></pre>
  <p>}</p>
  <p>How do I make my app automatically detetct the Telugu text? Do I have to use a flag value?</p>