title: print string contain turkey characters in java
body: <p>I am creating a string in my spring controller, it contain turkish characters </p>
  
  <p>String str1 = "iş ortaklığı";</p>
  
  <p>If i try to print it like
  System.setOut(new PrintStream(System.out,true,"UTF-8"));
                System.out.println(s);</p>
  
  <p><strong>output is</strong> iÅŸ ortaklÄ±ÄŸÄ±</p>
  
  <p>byte[] utf81 = str1.getBytes("UTF-8");
               test3 = new String(utf8);</p>
  
  <pre><code>        System.out.println(test3);
  </code></pre>
  
  <p><strong>output is</strong> iÅŸ ortaklÄ±ÄŸÄ±</p>
  
  <p>byte[] utf8 = str1.getBytes("windows-1254");
               test3 = new String("windows-1254");</p>
  
  <p><strong>output is</strong> iÃ¾ ortaklÃ½Ã°Ã½</p>
  
  <p><strong>But All the above code works fine in console program that is main method</strong>
  main method prints output like<br>
   iş ortaklığı</p>
  
  <p>Any suggetion must appriciable</p>