Skip to content

Instantly share code, notes, and snippets.

@autarch
Created June 16, 2014 20:04
Show Gist options
  • Save autarch/84c2699de225d65102ec to your computer and use it in GitHub Desktop.
Save autarch/84c2699de225d65102ec to your computer and use it in GitHub Desktop.
use v5.14;
use strict;
use warnings;
use utf8;
use Encode qw( decode encode is_utf8 );
my $bytes = join q{}, map { chr($_) } 240, 159, 152, 184;
say $bytes;
my $unicode = decode( 'utf-8', $bytes );
my $maybe_utf8 = "$bytes $unicode";
say is_utf8($maybe_utf8) ? 'yes' : 'no';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment