Make user sorting by his localized encoding name instead of utf-8 encoding name
For those using non-ASCII systems, sorting user by name using a utf-8 encoding name and sorting user by name using their localized encoding name have different results.
For example: there are three users: user1, user2, user3.
If we sort them by name using the original utf-8 strings, the order may be: user1, user2, user3.
But when we convert the name string to another encoding(like gb2312) first, and then sort them by name, the result's order may be: user2, user1, user3.
And the second result is more acceptable than the first one.
So I thought that it would be great to convert the name string from utf-8 to the localized encoding before sorting user by name.
Since there is just one line bo be add to the user's model class, I didn't attach a diff file.
About line 217:
def <=>(user) ic = Iconv.new(l(:general_csv_encoding), 'UTF-8') ic.iconv(self.to_s.downcase) <=> ic.iconv(user.to_s.downcase) end