in reply to Re: Unicode surrogate is illegal in UTF-8
in thread Unicode surrogate is illegal in UTF-8

Could I generate/detect this warning without using "print" (i.e. so I could fix/replace silently)?
  • Comment on Re^2: Unicode surrogate is illegal in UTF-8

Replies are listed 'Best First'.
Re^3: Unicode surrogate is illegal in UTF-8
by choroba (Cardinal) on Aug 03, 2015 at 21:23 UTC
    You can print to a filehandle that doesn't lead anywhere:
    open my $VOID, '>', \ my $void; 1 until eval { print {$VOID} $text->{string}; # ...
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
Re^3: Unicode surrogate is illegal in UTF-8
by afoken (Chancellor) on Aug 05, 2015 at 03:33 UTC
    Could I generate/detect this warning without using "print" (i.e. so I could fix/replace silently)?

    Have a look at Handling Malformed Data.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)