Re: UTF8 locale & shell encoding

From: Philippe Verdy (verdy_p@wanadoo.fr)
Date: Fri Jan 16 2004 - 07:44:43 EST

  • Next message: Jon Hanna: "Re: UTF8 locale & shell encoding"

    From: "Jon Hanna" <jon@hackcraft.net>
    > > For these functions to behave correctly , i need to set locale to
    xxx.UTF-8
    > > As solaris has en_US.UTF8 (w/o installing any extra support) , there is
    no
    > > problem.
    > [snip]
    > > But i am having problem especially in windows, as i can't find a locale
    > > supporting this.
    > > i tried changing windows code page to utf8 using _setmbcp(65001), but it
    > > didn't work
    > > as the functions i am using is locale dependent.
    >
    > In windows the naming convention for locale's is different, although you
    were on
    > the right track with the _setmbcp call.
    >
    > The windows name for "en_US.UTF8" is "English_United States.65001",
    ".65001"
    > will be UTF-8 in the default locale.

    It would be good to say that this depends on the compiler tool you use, and
    its version... There's nothing less portable _on Windows_ than the "standard
    C/C++ library", which try to mimic more or less successfully what is offered
    on Unix/Linux and other POSIX systems... The only stable APIs which are
    cross-compiler compatible on Windows are the Win32 APIs, which is guaranteed
    to depend only on the hosting OS version, but not also across the many
    compilers available for this platform...

    So unless the developer sticks at a particular compiler and version for
    Windows, using the standard library to perform locale-related work will
    remain highly non-portable. Almost all C/C++ sources for Windows then depend
    on a particular compiler version, and there's no guarantee the same source
    code will compiler and work identically with another compiler, even from the
    same compiler provider.



    This archive was generated by hypermail 2.1.5 : Fri Jan 16 2004 - 08:28:18 EST