Skip to content

Instantly share code, notes, and snippets.

@lopnor
Created September 1, 2009 05:42
Show Gist options
  • Save lopnor/178926 to your computer and use it in GitHub Desktop.
Save lopnor/178926 to your computer and use it in GitHub Desktop.
#!perl
use strict;
use warnings;
use utf8;
use Test::More;
{
my $hash = {};
$hash->{foobar} = 'hogehoge';
my ($key, $value) = %$hash;
ok ! utf8::is_utf8($key); # fails!
ok ! utf8::is_utf8($value);
}
{
my $hash = {};
$hash->{'foobar'} = 'hogehoge';
my ($key, $value) = %$hash;
ok ! utf8::is_utf8($key);
ok ! utf8::is_utf8($value);
}
{
my $hash = {foobar => 'hogehoge'};
my ($key, $value) = %$hash;
ok ! utf8::is_utf8($key); # fails!
ok ! utf8::is_utf8($value);
}
{
my $hash = {'foobar' => 'hogehoge'};
my ($key, $value) = %$hash;
ok ! utf8::is_utf8($key);
ok ! utf8::is_utf8($value);
}
done_testing;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment