Skip to content

Instantly share code, notes, and snippets.

@autarch
Created October 4, 2015 16:27
Show Gist options
  • Select an option

  • Save autarch/b9264b8daa59358d25c3 to your computer and use it in GitHub Desktop.

Select an option

Save autarch/b9264b8daa59358d25c3 to your computer and use it in GitHub Desktop.
sub _dump_with_unicode ($self, $val) {
my $dumped = Dumper($val);
$dumped
=~ s/\\x\{([^}]+)\}/$self->_unicode_char_for($1)/eg;
return $dumped;
}
sub _unicode_char_for ($, $hex) {
my $num = eval '0x' . $hex;
die $@ if $@;
return '\N{U+' . sprintf( '%04x', $num ) . '}';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment