Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2021-03-18
20:27 • Ticket [2549196fff] Add locale support for case management status still Open... artifact: 624fd45fd7 user: jan.nijtmans
2014-02-21
19:09 • Ticket [2549196fff]: 1 change artifact: f31ca7d7ac user: jan.nijtmans
2009-01-30
22:01 • Ticket [2549196fff]: 4 changes artifact: 4170f3b302 user: nijtmans
21:39 • Ticket [2549196fff]: 4 changes artifact: 0a8f615a4f user: ferrieux
21:24 • Ticket [2549196fff]: 4 changes artifact: a112ff87b6 user: dkf
21:19 • Ticket [2549196fff]: 4 changes artifact: 683d08cc77 user: ferrieux
14:10 • New ticket [2549196fff]. artifact: 96d3404f5b user: dkf

Add locale support for case management

Open2549196fffffffffffffffffffffffffffffffffCreated 18 years agoUpdated 6 years ago
Descriptionplain2009-01-30 14:10:04
Tcl needs a system for doing case folding and case-insensitive comparisons. Works out as being adding a suitable -locale option to the following commands:
  lsearch,
  lsort,
  regexp,
  regsub,
  string compare,
  string equal,
  string is (possibly),
  string match,
  string tolower,
  string totitle,
  string toupper,
  switch -nocase

Possibly also need to consider allowing other things to fit into the locale system (esp. the number handling of [format] and [scan]) but those might be delegatable to another issue.

[[THIS FRQ IS BEING USED TO COALESCE OTHERS]]
ferrieuxplain2009-01-30 21:19:10
I understand comparisons are sensitive to the locale, but why are [string to*] included in this list ?
dkfplain2009-01-30 21:24:52
Turkish has strange rules for dotted and dotless 'i's. Alas. There may be other oddities out there, but I've not done a proper literature search.
ferrieuxplain2009-01-30 21:39:20
Are the oddities locale-specific for a given character (e.g. [string toupper i]->I in English and ??? in Turkish), or character-specific ([string toupper bizarre-i-from-Turkish-codepage]->some-other-bizarre-char) ?

If the latter, [string to*] don't need locale dependency, they just need love and care to properly handle the whole set of Unicode characters.
nijtmansplain2009-01-30 22:01:23
There is a document describing this:
  <http://www.unicode.org/reports/tr21/tr21-5.html#Caseless_Matching>

In short, apart from "string tolower", "string toupper" and
"string totitle", there should be a new "string fold"
which 'folds' the string to a case-insensite form, ready
to be compared with another case 'folded' string.

The new "string fold" function will do the same as
"string tolower" for most locales, but turkish is an
example where things are different.

Apart from that, I would expect new functions:
    string is folded $s => [expr {[string fold $s] eq $s}]
    string is title $s => [expr {[string totitle $s] eq $s}]

Looking at the unicode case fonding table:
  http://www.unicode.org/Public/3.2-Update/CaseFolding-3.2.0.txt
It seems that turkish is the only special case.
jan.nijtmans Ticket [2549196fff]: 1 change [History diff]2014-02-21 19:09:01
jan.nijtmanswiki2021-03-18 20:27:55

Let's see if we can start doing something about this.

Log in (anonymous is fine) to add a comment.