title: Encode String to UTF-8 in Kotlin
body: <p>Often times when dealing with json and responses you want to encode String to UTF-8 in java.</p>
  
  <pre><code>String response = new String(response.data, UTF); // java code
  </code></pre>
  
  <p>For Kotlin, how is this done? I converted my Java class and the result was</p>
  
  <pre><code>String response = String(response.data, UTF) // kotlin code
  </code></pre>
  
  <p>But this results in an error, because I believe the Kotlin String() method is different than what I am doing in Java. Is it as simple as using the toString()?</p>
  
  <pre><code>String response = response.data.toString() // kotlin code
  </code></pre>
  
  <p>How does the system know to use UTF-8, or is that just the default? This is just hypothetical, but what if I wanted to do something with String object and therefore used UTF-16? How can I change the encoding?</p>