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

Hellow my esteemed fellow monks,

I am having problems having Perl to convert to lowercase properly Ú, É, Ê and everything that takes accentuation. I am seting the locale through the code below.

if ( $online == 1 ) { # i set this one before, according to the enviro +nment: production or development use POSIX 'locale_h'; setlocale( LC_ALL, "pt_BR.ISO8859-1" ); }
I don´t know if this is not the right locale or if I am setting it the wrong way. Any ideas?

Thanks a lot

Andre_br

Replies are listed 'Best First'.
Re: Correct Locale for brazilian portuguese (or French!)
by Tanktalus (Canon) on Jun 20, 2005 at 22:04 UTC

    To be honest, that depends on what platform you're on. Try running "locale -a" to get a list of all the locales supported by your platform. I didn't install Brazilian Portuguese on my Linux box, so I can't easily check what locale that is for Gentoo. :-)

    It is so bad that our product has created a huge mapping of tonnes of locale names to platform-specific locale tokens just to try to simplify our install and use of all the encodings and languages. And, yes, pt_BR is among them. On a few platforms.

      I issued the command you said, and I have all these:
      pt_BR pt_BR.iso88591 pt_BR.utf8 pt_PT pt_PT@euro pt_PT.iso88591 pt_PT.iso885915@euro pt_PT.utf8
      I am using the pt_PT.iso88591 that it works with a string I type in the cgi script but does not in a string extracted from a .xls file with the Spreadsheet::ParseExcel module. How come??

        You probably need to encode/decode whatever encoding that XLS is using. Most likely, it's UTF8. So you should probably check the Encode module to decode from utf8 to pt_BR.iso88591.

        Remember - just because you're running in a locale doesn't mean the data you're reading is in that locale. :-)