Bogus locales on Mac

Discussion in 'Python' started by Ellen Herzfeld, Jul 14, 2004.

  1. I have been tearing my hair out trying to get Python to sort strings
    containing accented characters according to the French locale settings
    on Mac OS X (10.3).

    I think I've done it correctly because on a Linux box it works...

    What I find in the Mac's entrails is this:
    /usr/share/locale/fr_FR.UTF-8 contains
    LC_COLLATE -> ../la_LN.UTF-8/LC_COLLATE
    LC_CTYPE -> ../la_LN.UTF-8/LC_CTYPE
    LC_TIME
    ....

    I checked some other locale directories and found the same link to
    la_LN.UTF-8/LC_COLLATE, so whatever language you think you are
    choosing, you are actually getting the same thing... I don't know what
    la_LN is, maybe LATIN... The LC_COLLATE file in /la_LN.UTF-8 is 4642
    bytes, the equivalent Linux file is 882134 bytes...

    The date strings for the months are really in French in LC_TIME, and
    using it does work correctly.

    I tried using the Linux LC_COLLATE file on the Mac but it didn't work.

    Has anyone using a Mac managed to sort accented strings correctly?

    The Mac has mostly tried to be quite international so I'm surprised at
    this. Have I missed something?

    Thanks.

    Ellen

    --
    -------------------------------------------------------------------
    | Ellen C. Herzfeld
    http://www.quarante-deux.org/ | Dominique O. Martel
    Quelques pages sur la Science-Fiction | Quarante-Deux
    -------------------------------------------------------------------
    Ellen Herzfeld, Jul 14, 2004
    #1
    1. Advertising

  2. Ellen Herzfeld <> writes:

    [snip]
    > Has anyone using a Mac managed to sort accented strings correctly?
    >
    > The Mac has mostly tried to be quite international so I'm surprised at
    > this. Have I missed something?


    I suspect using some other method than the C libraries locale
    functions is necessary... something like CFStringCompare? Dunno if
    Python wraps that, though. Or maybe use PyObjC and NSSting's
    -compare:eek:ptions:range:locale: method.

    HTH,
    mwh

    --
    <dash> wow. this code does something highly entertaining, but
    nowhere near correct -- from Twisted.Quotes
    Michael Hudson, Jul 15, 2004
    #2
    1. Advertising

  3. In article <>, Michael Hudson
    <> wrote:

    > I suspect using some other method than the C libraries locale
    > functions is necessary... something like CFStringCompare? Dunno if
    > Python wraps that, though. Or maybe use PyObjC and NSSting's
    > -compare:eek:ptions:range:locale: method.


    I suppose there must be some way around the problem using Mac specific
    code, but I need my scripts to be portable with minimum hassle. They
    may have to run on a Linux or FreeBSD server...

    I would like confirmation that I'm not missing something. Why would
    Apple not use the standard C files for locales?

    Ellen

    --
    -------------------------------------------------------------------
    | Ellen C. Herzfeld
    http://www.quarante-deux.org/ | Dominique O. Martel
    Quelques pages sur la Science-Fiction | Quarante-Deux
    -------------------------------------------------------------------
    Ellen Herzfeld, Jul 15, 2004
    #3
  4. In article <150720041857252245%>, Ellen Herzfeld
    <> wrote:

    > I suppose there must be some way around the problem using Mac specific
    > code, but I need my scripts to be portable with minimum hassle. They
    > may have to run on a Linux or FreeBSD server...
    >
    > I would like confirmation that I'm not missing something. Why would
    > Apple not use the standard C files for locales?
    >



    Update:
    The problem seems to be with the FreeBSD librairies for locales and not
    with Apple. The sort problem is identical on FreeBSD 5.2.1. On Linux
    (Mandrake) sorting is correct...

    Ellen

    --
    -------------------------------------------------------------------
    | Ellen C. Herzfeld
    http://www.quarante-deux.org/ | Dominique O. Martel
    Quelques pages sur la Science-Fiction | Quarante-Deux
    -------------------------------------------------------------------
    Ellen Herzfeld, Jul 16, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Karl Seguin

    firewalls "removing bogus header"

    Karl Seguin, Feb 10, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    1,401
    George Ter-Saakov
    Feb 10, 2004
  2. Doug

    I.E. Bogus Progress Meter?

    Doug, Aug 3, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    356
    Kevin Spencer
    Aug 3, 2004
  3. Tina

    PrepLogic bogus Answers

    Tina, Oct 11, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    367
    clintonG
    Oct 12, 2004
  4. pepe

    locales in Mac OS

    pepe, Apr 19, 2007, in forum: Ruby
    Replies:
    0
    Views:
    93
  5. Jim Anderson

    perl 5.8.1, Mac OS, and locales

    Jim Anderson, Oct 13, 2003, in forum: Perl Misc
    Replies:
    3
    Views:
    122
    Jim Anderson
    Oct 14, 2003
Loading...

Share This Page