diff options
-rwxr-xr-x | bsgrep | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -73,6 +73,15 @@ sub handle_line { } ### main() +# TODO: do we need 'use locale'? +# also, why does reading iso-8859-1 text auto-convert to utf-8? +for (qw/LANG LC_CTYPE LC_ALL/) { + if(($ENV{$_} // "") =~ /utf-?8/i) { + binmode(\*STDIN, ':utf8'); + binmode(\*STDOUT, ':utf8'); + last; + } +} if(defined($ARGV[0])) { if($ARGV[0] =~ /-help/) { |