aboutsummaryrefslogtreecommitdiff
path: root/bsgrep
diff options
context:
space:
mode:
Diffstat (limited to 'bsgrep')
-rwxr-xr-xbsgrep9
1 files changed, 9 insertions, 0 deletions
diff --git a/bsgrep b/bsgrep
index 26f247e..d4ef311 100755
--- a/bsgrep
+++ b/bsgrep
@@ -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/) {