Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Please tell me if there's any way to use locale's on Win32 systems... is there any custom locale engine, or a way to import locale definition files at run-time ?

Thanks!

Joustin

  • Comment on LOCALE on non-posix compliant systems (Win32) ?

Replies are listed 'Best First'.
(tye)Re: LOCALE on non-posix compliant systems (Win32) ?
by tye (Sage) on Mar 26, 2001 at 20:31 UTC

    My quick reading on locale-related functions in the Win32 SDK documentation indicates that locale support under Win32 is much the same as under Unix or other platforms that support ANSI C.

    Perhaps you could be more specific? What have you tried? How did it not work?

            - tye (but my friends call me "Tye")
      All right...
      I want to use locales under Win2k. I've tried just setting the locales with use locale; This gives me extra characters, which are NOT polish ones (which I need). Specifying the standard with setlocale(LC_CTYPE, "pl"); ..didn't work...
      MAN gives the url: ftp://dkuug.dk/i18n/WG15-collection There's a collection of locale definition files, but I have no idea how to merge one into Windows. I need locales to properly sort(), s/// and cmp.

      the test:   use locale; $a="Pérl"; $b = uc($a); print $b; ...returns:PéRL

      the test2:

      for ($x = 0;$x < 255;$x++){ $_ = chr($x); if (/\w/){ print "$_ ";} }

      This one will print You all known word characters... when You've got the PL locale, you should be getting also '³ ó œ æ Ÿ ¿ ñ'

      Mbr> Thanks!

      Edit 2001-03-26 by tye remove <pre>

        Two trains of thought :

        OS goodies

        First off, I'd make sure you've got a locale.inf file in %windir%\inf directory. This is the definition file for locales.
        Then verify that your language is set to Polish in the Regional Settings control panel.

        Perl Goodies

        perl -V:d_setlocale should return "define".</code>This means that perl thinks it can handle locales. If this doesn't return define, ain't nothing gonna work
        try using the locales ISO-8859-4 or ISO-8859-2 instead of pl in setlocale. These are Baltic and Central European charsets, respectively. There's 7 or so environment variables you can set if setlocale doesn't seem to work:
        • LC_ALL
        • LC_CTYPE
        • LC_COLLATE
        • LC_MONETARY
        • LC_NUMERIC
        • LC_TIME
        • LANG
        if this still doesn't work, perl should emit some error telling you that the locale is bad, or some other bad thing is occurring. Good luck!
        Update Don't change locales when running scripts in Excel, or you'll mess up any currency values :(. I take it that this Z3 thing is for Zloty??