Menu

problem with sort and locale

Help
2006-10-25
2012-07-26
  • Nobody/Anonymous

    I am having trouble getting sort to produce output that is sorted by native byte value.
    This means that I want

    a
    A
    a
    A
    B
    B
    b
    B
    b

    to become

    A
    A
    B
    B
    B
    a
    a
    b
    b

    not

    a
    a
    A
    A
    b
    b
    B
    B
    B

    as is the case with sort from gnuwin32 coreutils-5.3.0

    Trouble with the locale is probably the cause of this. I have seen several other posts about this problem on this forum, indicating that sort uses the default locale no matter what LC_ALL is set to. Has anyone found a solution?

    Thanks in advance

    Dag S.E.

     
    • Keith Marshall

      Keith Marshall - 2006-10-26

      Blame Microsoft for this -- their setlocale' implementation honours neitherLANG' nor LC_CATEGORY' settings in the environment; neither are their language and territory codes compatible with the relevant ISO standards, which GNUsort' expects.

      FWIW, I've been working on a setlocale' wrapper library for MinGW, to add ISO-639-1/2 and ISO-3166LC_CATEGORY' support; I can make this available to anyone who cares to rebuild the GnuWin32 tools to use it, but it is in very much an embryonic state at present.

      Regards,
      Keith.

       
MongoDB Logo MongoDB