Re: sorting slovak utf
From: Martin v. Löwis (martin_at_v.loewis.de)
Date: 12/08/03
- Next message: Terry Reedy: "Re: Speed: bytecode vz C API calls"
- Previous message: Todd Gardner: "Re: How to use the outp(...) command"
- In reply to: Stano Paska: "sorting slovak utf"
- Next in thread: Jeff Epler: "Re: sorting slovak utf"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 08 Dec 2003 18:40:44 +0100
Stano Paska <paska@kios.sk> writes:
> 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?
You don't need to operate in a UTF-8 locale. Instead, any Slovak
locale will do, provided your system offers locale.strcoll for Unicode
objects (try locale.strcoll(u"", u"")).
In this case, you can convert all strings to Unicode, and then collate
using locale.strcoll.
Alternatively, you could set the locale to any Slovak locale, and use
locale.getpreferredencoding() to find the locale's encoding. Then you
could convert all input strings to that encoding, and use
locale.strcoll to collate them as byte strings.
Regards,
Martin
- Next message: Terry Reedy: "Re: Speed: bytecode vz C API calls"
- Previous message: Todd Gardner: "Re: How to use the outp(...) command"
- In reply to: Stano Paska: "sorting slovak utf"
- Next in thread: Jeff Epler: "Re: sorting slovak utf"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|