sorting slovak utf
Stano Paska
paska at kios.sk
Mon Dec 8 08:07:32 EST 2003
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
>
>
>
>
>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: aaa.txt
URL: <http://mail.python.org/pipermail/python-list/attachments/20031208/01792e91/attachment.txt>
More information about the Python-list
mailing list