Umlaut Aware Alphabetical Sorting

The simples solution i could come up with, convert all chars to their base (á -> a), using would be ideal for this task, but its not UTF8 aware…

If you dare to digg deeper, more information can be found on wiki and on coding horror

list.sort_by{|name| convert_umlaut_to_base(name)}

  def convert_umlaut_to_base(input)
    text = input.dup
    %w[áäa ÁÄA óöo ÓÖO íi ÍI úüu ÚÜU ée ÉE ßs].each do |set|

One thought on “Umlaut Aware Alphabetical Sorting

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s