in reply to ucfirst doesn't work if first character of word a special finnish character

Try this:
use locale; use POSIX qw(locale_h); setlocale(LC_CTYPE, 'fi_FI'); setlocale(LC_COLLATE, 'fi_FI');
I think this may be somewhat platform dependant, but it works for me.
  • Comment on Re: ucfirst doesn't work if first character of word a special finnish character
  • Download Code

Replies are listed 'Best First'.
Re^2: ucfirst doesn't work if first character of word a special finnish character
by Anonymous Monk on Oct 03, 2006 at 12:24 UTC

    Hi!

    I tried with this, but still it doesn't work.

    ----------

    use locale; use POSIX qw(locale_h); setlocale(LC_CTYPE, 'fi_FI'); setlocale(LC_COLLATE, 'fi_FI'); print ucfirst "äbcdef";

    -----------

    But it prints "-bcdef" i.e "ä" is not being printed correctly.

    Do I need to do anything else?

    Thanks.

    Edited by planetscape - added code tags and rudimentary formatting

      Are you printing directly to STDOUT? It may just be that wherever you're printing it to is unable to display the character correctly.
        Hi! Yes, I am directly printing it to STDOUT. Can't I do that? Thanks,
Re^2: ucfirst doesn't work if first character of word a special finnish character
by asfar (Novice) on Oct 03, 2006 at 12:45 UTC
    Hi! I tried with this, but still it doesn't work. ---------- use locale; use POSIX qw(locale_h); setlocale(LC_CTYPE, 'fi_FI'); setlocale(LC_COLLATE, 'fi_FI'); print ucfirst "äbcdef"; ----------- But it prints "-bcdef" i.e "ä" is not being printed correctly. Do I need to do anything else? Thanks.
      Hi! Yes, I am directly printing it to STDOUT. Can't I do that? Thanks,