The following lines are a sample definition of a LC_COLLATE locale category, as they might appear in a locale source file.
The category source is on the left of the page and explanations are to the right, followed by some example string comparisons in the resulting very strange locale.
| ( widen viewing area so this line does not wrap ) | |
| LC_COLLATE # ARTIFICIAL COLLATE CATEGORY |
|
| #
collating elements collating-element <ch> from "<c><h>" collating-element <Ch> from "<C><h>" collating-element <eszet> from "<s><z>" |
Collating
elements
|
| #collating symbols for relative order definition | |
| collating-symbol
<LOW> collating-symbol <UPPER-CASE> collating-symbol <LOWER-CASE> collating-symbol <NONE> |
Collating symbols <LOW>, <UPPER-CASE>, <LOWER-CASE> and <NONE> are defined to be used in relative order definition |
| order_start
forward;backward;forward <NONE> |
Up to 3
string comparisons are defined:
|
| <LOW> <UPPER-CASE> <LOWER-CASE> |
The collating
weights are defined such that:
|
| UNDEFINED IGNORE;IGNORE;IGNORE | All characters for which collation is not specified here are ordered after <NONE>, and before <space> in ascending order according to their encoded values |
| <space> ... <quotation-mark> |
All characters with an encoded value larger than the encoded value of <space> and lower than the encoded value of <quotation-mark> in the current encoded character set, collate in ascending order according to their values |
| <a> <a>;<NONE>;<LOWER-CASE> | <a>
has a:
|
| <a-acute> <a>;<a-acute>;<LOWER-CASE> | <a-acute>
has a:
|
| <a-grave> <a>;<a-grave>;<LOWER-CASE> | <a-grave> has a:
|
| <A> <a>;<NONE>;<UPPER-CASE> | <A>
has a:
|
| <A-acute> <a>;<a-acute>;<UPPER-CASE> | <A-acute> has a:
|
| <A-grave> <a>;<a-grave>;<UPPER-CASE> | <A-grave> has a:
|
| <ch> <ch>;<NONE>;<LOWER-CASE> | <ch> has a:
|
| <Ch> <ch>;<NONE>;<UPPER-CASE> | <Ch> has a:
|
| <s> <s>;<s>;<LOWER-CASE> | <s> has a:
|
| <eszet> "<s><s>";"<eszet><s>";<LOWER-CASE> | <eszet> has a:
|
| <z> <z>;<NONE>;<LOWER-CASE> | <z> has a:
|
| order_end |
Compare
"aAch" and "AaCh"
In a locale built from the above LC_COLLATE definition, the
comparison of the strings s1="aAch" and
s2="AaCh" is processed as follows:
s1=> "aA<ch>", and s2=> "Aa<Ch>"
Compare
"a1sz" and "a2ss"
In a locale built from the above LC_COLLATE
definition above, the comparison of the strings s1="a1sz"
and s2="a2ss" is processed as follows:
![]()
Internationalization
Localization
and Locales
![]()
LC_COLLATE
Locale Category
LC_COLLATE
Collating Rules
LC_COLLATE
Collating Keywords
Locale
Categories
Locale
Source Files