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

If you can't get locales working, another alternative is to temporarily put your data into perl's internal utf8 encoding, something like:
use Encode qw/encode decode/; my @strings = ("\xe4ll your chars","\xe5re belong to", "\xf6s"); $_ = encode("iso-8859-15", ucfirst(decode("iso-8859-15",$_))) for @str +ings;
  • 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 Burak (Chaplain) on Oct 03, 2006 at 19:14 UTC
    There may be a shortcut :) You can save the source file with UTF-8 Encoding (Notepad in Win XP can do this) and then load utf8:
    use utf8; print ucfirst "äbcdef";
    And if you can save the source file with a BOM (I'm not sure about Notepad, but Komodo can do this) I think that utf8 pragma will became useless and any unicode character can be used without any extra effort (with Perl 5.8+)