Bug 16608 - es_US locale has invalid collation rules for 'ch' and 'll'
Summary: es_US locale has invalid collation rules for 'ch' and 'll'
Status: WAITING
Alias: None
Product: glibc
Classification: Unclassified
Component: localedata (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-19 17:38 UTC by Aldo
Modified: 2017-10-21 08:25 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments
icu sort sample program (577 bytes, text/plain)
2014-02-19 21:04 UTC, Aldo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aldo 2014-02-19 17:38:18 UTC
The es_EC locale file (which depends on es_US) defines 'ch' and 'll' as standalone letters for collation. This is an incorrect collation procedure according to the rules of the Spanish Royal Academy since 1997 (see http://www.rae.es/consultas/exclusion-de-ch-y-ll-del-abecedario)

According to the above rules, words with ch and ll are to be sorted as simply having a 'c' and 'h' and double 'l' 

E.g.:
incorrect (current): file_ce, file_cf, file_cg, file_cz, file_ch
correct (expected): file_ce, file_cf, file_cg, file_ch, file_cz

The es_ES file specifies the correct behavior and the rest of es_* files depend on it.

Please either make es_EC depend on es_ES or fix es_US
Comment 1 Carlos O'Donell 2014-02-19 18:28:09 UTC
Do we know what CLDR does here?
Comment 2 Aldo 2014-02-19 18:42:06 UTC
Not entirely sure if this link is the right one, but it seems they agree with the rules:

http://st.unicode.org/cldr-apps/v#/es_EC/Alphabetic_Information/
Comment 3 Carlos O'Donell 2014-02-19 18:52:09 UTC
(In reply to Aldo from comment #2)
> Not entirely sure if this link is the right one, but it seems they agree
> with the rules:
> 
> http://st.unicode.org/cldr-apps/v#/es_EC/Alphabetic_Information/

That doesn't provide enough information. For example if instead you use libicu (http://site.icu-project.org/) to do the sorting and it comes out as expected then that argues CLDR has the same interpretation. In the light of our desire to harmonize better with CLDR we would make the change locally.
Comment 4 Aldo 2014-02-19 19:08:19 UTC
That makes sense. However, es_EC is the only locale of a latinamerican country inheriting collation from es_US (we do use the US dollar, but text is collated as specified by the authority, which is the case for the other countries), which looks more like a bug to me.
Comment 5 Aldo 2014-02-19 21:04:50 UTC
Created attachment 7429 [details]
icu sort sample program
Comment 6 Aldo 2014-02-19 21:05:56 UTC
Comment on attachment 7429 [details]
icu sort sample program

I have written a small sort program using libicu to sort the strings "ca", "ch", "cz", and "cñ". Compile it with 
gcc sort.c -licui18n -licuuc -licuio

It takes the locale as the first command-line argument.

A sample run:

$ ./a.out es_EC
Unsorted array (using: es_EC)
ch cñ cz ca
Sorted array (using: es_EC)
ca ch cñ cz