title: Converting string from UTF-8 to ANSI and displaying it as UTF-8
body: <p>I want to mimic with <code>Java</code> one thing I can do with <code>Notepad++</code>.</p>
  
  <pre><code>TEXT_2 = convert(TEXT_1) // where: TEXT_2 = "Български", TEXT_1 = "Ð‘ÑŠÐ»Ð³Ð°Ñ€ÑÐºÐ¸"
  </code></pre>
  
  <blockquote>
    <p>How to do it with Notepad++</p>
  </blockquote>
  
  <p><strong>Setting the starting point...</strong></p>
  
  <p>Open <code>Notepad++</code> and click: <code>Encoding / Encode in UTF-8</code>, then paste <code>TEXT_1</code>:</p>
  
  <pre><code>Ð‘ÑŠÐ»Ð³Ð°Ñ€ÑÐºÐ¸
  </code></pre>
  
  <p><strong>Getting TEXT_2</strong></p>
  
  <p>Click: <code>Encoding / Convert to ANSI</code>, then click: <code>Encoding / Encode in UTF-8</code>. Done.</p>
  
  <blockquote>
    <p>How to do it with Java</p>
  </blockquote>
  
  <p>So far I have the following function (which works partially):</p>
  
  <pre><code>public static String convert(String text) {
      String output = new String(Charset.forName("Cp1252").encode(text).array(), Charset.forName("UTF8"));
      return output;
  }
  System.out.println(convert("Ð‘ÑŠÐ»Ð³Ð°Ñ€ÑÐºÐ¸"));
  </code></pre>
  
  <p>With this function I get:</p>
  
  <pre><code>Българ�?ки // where correct is slightly different: Български
  </code></pre>
  
  <p>any idea to make it work?.</p>
  
  <p>If possible, could you provide the code that would work inside the function <code>convert()</code>?. Thanks.</p>