title: Java array sort UTF-8
body: <p>I want to sort an <code>ArrayList&lt;String&gt;</code> but the problem is my native language characters - my alphabet is like this: <code>a, ą, b, c, č, d, e, f ... z, ž</code>. As you see <code>z</code> character is second from the end and <code>ą</code> is second in alphabet, so after I sort my array it is sorted incorrectly. All my native language characters are moved to the end of array. Example:</p>
  
  <pre><code>package lt;
  
  import java.util.ArrayList;
  import java.util.Collections;
  
  public class test {
      public static void main(String[] args) {
          List&lt;String&gt; items = new ArrayList&lt;&gt;();
          items.add("bbc");
          items.add("ąbc");
          items.add("abc");
          items.add("zzz");
  
          System.out.println("Unsorted: ");
          for(String str : items) {
              System.out.println(str);
          }
  
          Collections.sort(items);
          System.out.println();
  
          System.out.println("Sorted: ");
          for(String str : items) {
              System.out.println(str);
          }
      }
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>Unsorted: 
  bbc
  ąbc
  abc
  zzz
  
  Sorted: 
  abc
  bbc
  zzz
  ąbc
  </code></pre>
  
  <p>Should be:</p>
  
  <pre><code>Sorted:
  abc
  ąbc
  bbc
  zzz
  </code></pre>