Defect #6523

Sort order doesn't treat german "umlaute" correct in user listing

Added by Frank Helk over 6 years ago. Updated about 2 years ago.

Status:Needs feedbackStart date:2010-09-28
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:I18n
Target version:Candidate for next major release
Resolution: Affected version:1.0.1

Description

Sorting of object seems to treat german special characters not correct.

Ä should range equal to ae, Ö should range equal to oe, Ü should range equal to ue and ß should range equal to ss.

Seems to be correct when user groups are listed, but broken when Users are listed (at least in groups), where ä,ö,ü and ß range behind z

History

#1 Updated by Daniel Felix over 4 years ago

  • Due date set to 2013-01-22
  • Status changed from New to Needs feedback

Well, any news on this? I tried this, but it seems to work on my system.

If there is no feedback on this issue, I'm going to close this next week.

#2 Updated by Frank Helk over 4 years ago

Sorry for being somewhat late ....

I'm somewhat overwhelmed with project work, so our redmine incarnation is not very up-to-date - means I'm at 1.3.1stable here.

I've checked on that anyhow, because it's way more current than the version the problem was reported for (1.0.1). The problem ist definitely there on V1.3.1.

I've opened a group's user list, and found the following sort order (names shortened ...)

Fi...
Ge...
Gi...
Gl...
Go...
Gr...
Gä... (wrong position)
Gü... (wrong position)
Ha...
He...
Hi...
Ho...
Hä... (wrong position)
Ig...

Could anybody from DE locale please check that with the current version ?

#3 Updated by Toshi MARUYAMA over 4 years ago

  • Category set to I18n

#4 Updated by Filou Centrinov over 4 years ago

In v2.2 everything is fine.

#5 Updated by Toshi MARUYAMA over 4 years ago

Filou Centrinov wrote:

In v2.2 everything is fine.

Ruby 1.8 or 1.9?

#6 Updated by Filou Centrinov over 4 years ago

Ruby 1.8 or 1.9?

ruby 1.9.1

Update: Only in the admin settings the group list is sorted correctly. When I want to add a group as a member to a project (in the project settings) the list is not correct!

Hint: In the german language the sorting of ä is equal to a. (ö=o, ü=u)

#7 Updated by Daniel Felix over 4 years ago

  • Target version set to 2.4.0

Any news on this issue?

Any idea how to fix this problem? Which coalition is used in the database table?

Maybe this could be a 2.4 goal.

#8 Updated by Daniel Felix about 4 years ago

  • Due date deleted (2013-01-22)

#9 Updated by Gabriel Mazetto about 4 years ago

This problem is somehow "unfixable", as there is no silver bullet.

By choosing one collation, you will "fix" it for one language, but break it for another one, because that's what collations are made for, to solve the problem of ordering characters.

Maybe the best sollution could be to high awareness of collations and help new users figure out what is the correct one they should use to support their languages.

Here are some documentations that could give more info on the problem:

#11 Updated by Etienne Massip about 4 years ago

Gabriel Mazetto wrote:

This problem is somehow "unfixable", as there is no silver bullet.

By choosing one collation, you will "fix" it for one language, but break it for another one, because that's what collations are made for, to solve the problem of ordering characters.

Redmine/Rails could handle ORDER BY .. COLLATE part depending on user profile?

#12 Updated by Jean-Philippe Lang almost 4 years ago

The problem seems to be more with ruby #sort:

Using the database sort (MySQL):

irb(main):002:0> Group.sorted.all.map(&:name)
  ←[1m←[35mGroup Load (0.0ms)←[0m  SELECT `users`.* FROM `users` WHERE `users`.`
type` IN ('Group') ORDER BY users.lastname ASC
=> ["Gä", "Gr", "Gü"]

Using ruby #sort (1.9.3):

irb(main):003:0> Group.all.map(&:name).sort
  ←[1m←[36mGroup Load (0.0ms)←[0m  ←[1mSELECT `users`.* FROM `users` WHERE `user
s`.`type` IN ('Group')←[0m
=> ["Gr", "Gä", "Gü"]

Filou Centrinov wrote:

Update: Only in the admin settings the group list is sorted correctly.

Because it uses a SQL ORDER

When I want to add a group as a member to a project (in the project settings) the list is not correct!

In 2.2, groups are sorted using ruby #sort for when adding a project member. Since 2.3, it uses a SQL ORDER statement so it should be OK now.

#13 Updated by Jean-Philippe Lang over 3 years ago

  • Target version changed from 2.4.0 to Candidate for next major release

2.4 feature freeze

#14 Updated by Rafał Lisowski about 2 years ago

I had the same problem on edit/add issue page and https://github.com/twitter/twitter-cldr-rb#sorting-collation help me.
I added this twitter_cldr gem to Gemfile.local and modify

app/helpers/application_helper.rb

 --- a/app/helpers/application_helper.rb
 +++ b/app/helpers/application_helper.rb
 @@ -392,7 +392,10 @@ module ApplicationHelper
        s << content_tag('option', "<< #{l(:label_author)} >>", :value => author.id)
      end
      groups = ''
 -    collection.sort.each do |element|
 +    lang = TwitterCldr.supported_locale?(current_language) ? current_language : :en
 +    collator = TwitterCldr::Collation::Collator.new(lang)
 +    collection.sort do |a, b|
 +      collator.compare(a.name, b.name)
 +    end.each do |element|
        selected_attribute = ' selected="selected"' if option_value_selected?(element, selected) || element.id.to_s == selected
        (element.is_a?(Group) ? groups : s) << %(<option value="#{element.id}"#{selected_attribute}>#{h element.name}</option>)
      end

Also available in: Atom PDF