How could I catch an "Unicode non-character"-warning?

Posted by sid_com on Stack Overflow See other posts from Stack Overflow or by sid_com
Published on 2011-02-26T15:22:11Z Indexed on 2011/02/26 15:25 UTC
Read the original article Hit count: 230

Filed under:
|
|
|
|

How could I catch the "Unicode non-character 0xffff is illegal for interchange"-warning?

#!/usr/bin/env perl
use warnings;
use 5.012;
use Try::Tiny;

use warnings FATAL => qw(all);

my $character;

try {
    $character = "\x{ffff}";
} catch {
    die "---------- caught error ----------\n";
};

say "something";

Output:

# Unicode non-character 0xffff is illegal for interchange at ./perl1.pl line 11.

© Stack Overflow or respective owner

Related posts about perl

Related posts about unicode