Re: [sqlite] toupper/tolower
I'm sorry: totally missed `The "function" method' :( So, it seems, that the problem's solved. :) -- pozdrawiam / regards Zbigniew Baniewski ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] toupper/tolower
On Sun, Jun 21, 2009 at 08:34:23PM -0400, Igor Tandetnik wrote: > http://www.sqlite.org/cvstrac/fileview?f=sqlite/ext/icu/README.txt Yes, I've found libraries made by someone, and ready to use. Unfortunately, they are of several MB size... :( No, I would to keep the application "compact", and because of this, the better way - if possible - would be suggested completion of TCL API. Even that I'm aware, that such external method will be slower. -- pozdrawiam / regards Zbigniew Baniewski ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] toupper/tolower
Zbigniew Baniewski wrote: > And yes - alas - upper/lower are unable to do it properly for > characters "outside ASCII". But I've found some more info: http://www.sqlite.org/cvstrac/fileview?f=sqlite/ext/icu/README.txt Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] toupper/tolower
On Sun, Jun 21, 2009 at 05:12:18PM -0700, Cory Nelson wrote: > Unfortunately, no. A correct toupper/tolower would require locale > support and passing in a string pointer, not a char. Even a wide > character can't store all the information needed to make something > upper/lower. OK, maybe different way then: There is - in SQLite's TCL API - a "collate" method: #v+ This method registers new text collating sequences. There are two arguments: the name of the collating sequence and the name of a TCL procedure that implements a comparison function for the collating sequence. For example, the following code implements a collating sequence called "NOCASE" that sorts in text order without regard to case: proc nocase_compare {a b} { return [string compare [string tolower $a] [string tolower $b]] } db collate NOCASE nocase_compare #v- Perhaps could be possible to add to that API something like external "tolower/toupper" methods, that could be registered from within TCL? -- pozdrawiam / regards Zbigniew Baniewski ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] toupper/tolower
On Sun, Jun 21, 2009 at 4:34 PM, Zbigniew Baniewskiwrote: > In the docs there is a remark: > > #v+ > upper(X) Return a copy of input string X converted to all upper-case > letters. The implementation of this function uses the C library routine > toupper() which means it may not work correctly on non-ASCII UTF-8 > strings. > #v- > > And yes - alas - upper/lower are unable to do it properly for characters > "outside ASCII". But I've found some more info: > > http://www.warpspeed.com.au/cgi-bin/inf2html.cmd?..%5Chtml%5Cbook%5CToolkt40%5CXPG4REF.INF+297 > > #v+ > Note: toupper and tolower can only be used for single-byte characters. > towupper and towlower should be used for case conversion of wide characters > that are equivalent to both single-byte and double-byte characters. > #v- > > It looks, like the problem could be easily solved just by replacing > "toupper/tolower" occurences with "towupper/towlower". Am I right? > If so - perhaps could be such change introduced in new version? Unfortunately, no. A correct toupper/tolower would require locale support and passing in a string pointer, not a char. Even a wide character can't store all the information needed to make something upper/lower. -- Cory Nelson http://int64.org ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users