Created
January 14, 2014 13:18
-
-
Save mrballcb/8418172 to your computer and use it in GitHub Desktop.
A perl addition to detect and re-exec itself if PERL_UNICODE env var is set. The var causes STDIN/STDOUT/STDERR to be read as multibyte utf-8 chars instead of just single byte ascii chars. This is useful when operations such as m// or s/// are looking for hex bytes, such as:
$line =~ s/\x{e2}\x{94}[\x{8c}-\x{bf}]/+/g;
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (defined $ENV{'PERL_UNICODE'}) | |
{ | |
delete $ENV{'PERL_UNICODE'}; | |
exec ($0, @ARGV); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment