# Sort array of strings with ÄÅ¡Å¾

**URL:** <https://www.ruby-forum.com/t/sort-array-of-strings-with-a-a-a/152770>\
**Category:** Rails\
**Created:** [November 7, 2008, 9:58am UTC](https://www.ruby-forum.com/t/sort-array-of-strings-with-a-a-a/152770 "2008-11-07T09:58:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sineserz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ad7895/32.png) [@sineserz](https://www.ruby-forum.com/u/sineserz)\
**Post date:** [November 7, 2008, 9:58am UTC](https://www.ruby-forum.com/t/sort-array-of-strings-with-a-a-a/152770/1 "2008-11-07T09:58:14Z")

</div>

hi,

I have problems with sorting array of strings with special characters (Ä  
Å¡ Å¾),

%w"abcÄdesÅ¡uvzÅ¾".sort =\> “abcdesuvzÄÅ¡Å¾”

the right order should be Ä after c, Å¡ after s and Å¾ after z.

I write my own sort method:

sort\_order = [‘a’,‘b’,‘c’,‘Ä’,‘d’,‘e’,‘f’,‘g’,‘h’,‘i’,‘j’,‘k’,‘l’,  
‘m’,‘n’,‘o’,‘q’,‘p’,‘r’,‘s’,‘Å¡’,‘t’,‘u’,‘v’,‘w’,‘z’,‘Å¾’,‘x’,‘y’]  
user\_items.sort\_by {|u| sort\_order.index(u.name.first)}

But it only works, if im sorting by first character.

How can i sort the whole words with right order?

example: %w"audi, bmw 320i, ,bmw 320d, seat, Å¡koda, …".

thanks

sergej
