From paska at kios.sk Mon Dec 8 03:23:21 2003 From: paska at kios.sk (Stano Paska) Date: Mon Dec 8 03:17:58 2003 Subject: [Python-nl] sorting slovak utf Message-ID: <3FD434F9.2070107@kios.sk> Hi, I have one problem. In file aaa.txt I have slovak letters in utf-8. zcaron scaron aacute ocircumflex tcaron yacute ccaron eacute lcaron iacute dcaron uacute adiaeresis oacute lacute ncaron racute with this script (output is redirected to file bbb.txt): import fileinput riadky = [] a = fileinput.input("aaa.txt") for i in a: riadky.append(i.strip()) a.close() riadky.sort() for i in riadky: print i I have this result: aacute adiaeresis eacute iacute oacute ocircumflex uacute yacute ccaron dcaron lacute lcaron ncaron racute scaron tcaron zcaron and corrent result would be: aacute adiaeresis ccaron dcaron eacute iacute lacute lcaron ncaron oacute ocircumflex racute scaron tcaron uacute yacute zcaron I have set utf-8 in sitecustomize.py I tried: import locale locale.setlocale(locale.LC_CTYPE, 'sk_SK.utf-8') and locale.setlocale(locale.LC_CTYPE, ('sk_SK', 'utf-8')) but i got "unsupported locale" error What I must do to get correct sorting result? Stano. P.S. lower, upper works correct From paska at kios.sk Mon Dec 8 08:07:07 2003 From: paska at kios.sk (Stano Paska) Date: Mon Dec 8 08:01:52 2003 Subject: [Python-nl] sorting slovak utf In-Reply-To: <3FD434F9.2070107@kios.sk> References: <3FD434F9.2070107@kios.sk> Message-ID: <3FD4777B.2000809@kios.sk> I forgot append a file. Stano Paska wrote: > Hi, > > I have one problem. > In file aaa.txt I have slovak letters in utf-8. > > zcaron > scaron > aacute > ocircumflex > tcaron > yacute > ccaron > eacute > lcaron > iacute > dcaron > uacute > adiaeresis > oacute > lacute > ncaron > racute > > with this script (output is redirected to file bbb.txt): > > import fileinput > riadky = [] > a = fileinput.input("aaa.txt") > for i in a: > riadky.append(i.strip()) > a.close() > riadky.sort() > for i in riadky: > print i > > I have this result: > > aacute > adiaeresis > eacute > iacute > oacute > ocircumflex > uacute > yacute > ccaron > dcaron > lacute > lcaron > ncaron > racute > scaron > tcaron > zcaron > > and corrent result would be: > > aacute > adiaeresis > ccaron > dcaron > eacute > iacute > lacute > lcaron > ncaron > oacute > ocircumflex > racute > scaron > tcaron > uacute > yacute > zcaron > > I have set utf-8 in sitecustomize.py > > I tried: > import locale > locale.setlocale(locale.LC_CTYPE, 'sk_SK.utf-8') > and > locale.setlocale(locale.LC_CTYPE, ('sk_SK', 'utf-8')) > but i got "unsupported locale" error > > What I must do to get correct sorting result? > > Stano. > > P.S. lower, upper works correct > > > > _______________________________________________ > Python-nl mailing list > Python-nl@python.org > http://mail.python.org/mailman/listinfo/python-nl > -------------- next part -------------- ž š á ô ť ý č é ľ í ď ú ä ó ĺ ň ŕ From gerrit at nl.linux.org Mon Dec 8 08:24:34 2003 From: gerrit at nl.linux.org (Gerrit Holl) Date: Mon Dec 8 08:25:15 2003 Subject: [Python-nl] sorting slovak utf In-Reply-To: <3FD434F9.2070107@kios.sk> References: <3FD434F9.2070107@kios.sk> Message-ID: <20031208132434.GA3652@nl.linux.org> Stano Paska wrote: > I have one problem. > In file aaa.txt I have slovak letters in utf-8. You have reached the Dutch Python mailing list. Maybe you'd better point this question to c.l.py, since you may have more chance in finding your luck there. Gerrit. -- 112. If any one be on a journey and entrust silver, gold, precious stones, or any movable property to another, and wish to recover it from him; if the latter do not bring all of the property to the appointed place, but appropriate it to his own use, then shall this man, who did not bring the property to hand it over, be convicted, and he shall pay fivefold for all that had been entrusted to him. -- 1780 BC, Hammurabi, Code of Law -- Asperger's Syndrome - a personal approach: http://people.nl.linux.org/~gerrit/english/