[development] Reverse iconv encoding for sorting of international arrays

Gabor Hojtsy gabor at hojtsy.hu
Thu Jan 11 19:37:58 UTC 2007


On Thu, 11 Jan 2007, [iso-8859-1] Bèr Kessels wrote:
> tagadelic has a bug[1]: when it sorts the tags based on their name, it
> compares two tags with strnatcasecmp. This is used to sort-order the array
> with tags.
>
> However, strnatcasecmp is not binary safe (grmmmbll), resulting in weird
> clouds. One would expect "Drive | every | état | Factory | fear " instead,
> état  will be placed even before the tags starting with 'a'.
>
> How is this dealt with normally, I can't beleive I am the first one to run
> into this?
> Is there a reverse for drupal_convert_to_utf8($data, $encoding), so that the
> result is 7bit-safe and usable in strnatcasecmp?
> Am I looking in the complete wrong direction?

Ber, ordering is different by language. Dutch people might have completely 
different rules for ordering for the same letters then Hungarians do. 
Using mbstring() functions might help, although those only allow for utf8 
handling, not proper locale handling. If you would like to have a function 
available for Drupal independently of the utf8 function set used, I don't 
think it is available already.

Gabor


More information about the development mailing list