in reply to Re: Odd problems with UTF-8, regexps, and newer Perl versions
in thread Odd problems with UTF-8, regexps, and newer Perl versions

Thanks for the quick reply. I tried that, too, and while the regexp then works, the behavior changes.

With only 'use utf8':
% ./test.pl
yep, is UTF8
success with B?ck

I see, "use encoding" also sets binmode on STDIN and STDOUT, so that while just using 'use' I need to explicitly add the binmode.

With use utf8 plus "binmode STDOUT ':utf8'":

% ./test.pl
yep, is UTF8
success with Böck

(My, Perl's unicode handling is complicated.) Now to see if I can apply this learning successfully to the original application, which is far more complex...

  • Comment on Re^2: Odd problems with UTF-8, regexps, and newer Perl versions

Replies are listed 'Best First'.
Re^3: Odd problems with UTF-8, regexps, and newer Perl versions
by moritz (Cardinal) on Jun 05, 2010 at 06:15 UTC
    I see, "use encoding" also sets binmode on STDIN and STDOUT, so that while just using 'use' I need to explicitly add the binmode.

    You can also use the open pragma for that, and also for future calls to open.

    Perl 6 - links to (nearly) everything that is Perl 6.