Advertisement
Guest User

Untitled

a guest
Jul 29th, 2014
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #!/usr/bin/env perl
  2. use warnings;
  3. use strict;
  4. use utf8;
  5. use open qw(:utf8 :std);
  6. use Encode qw(decode_utf8);
  7.  
  8. # ...
  9.  
  10. if ( not eval{
  11. # some error-messages (utf8) are decoded some are not
  12. 1 }
  13. ) {
  14. if ( utf8::is_utf8 $@ ) {
  15. print $@;
  16. }
  17. else {
  18. print decode_utf8( $@ );
  19. }
  20. }
  21.  
  22. # $@ is sometimes encoded. If it's not,
  23. # the following will leave it unchanged.
  24. utf8::decode($@);
  25.  
  26. print $@;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement