]> Dogcows Code - chaz/git-codeowners/blobdiff - lib/App/Codeowners/Formatter/String.pm
fix printing wide char with YAML formatter
[chaz/git-codeowners] / lib / App / Codeowners / Formatter / String.pm
index 6421783e5490501c784a77388c026e702080f218..e6613c1954dbfb5b009097804ab17190b59e0bd5 100644 (file)
@@ -18,7 +18,6 @@ use parent 'App::Codeowners::Formatter';
 
 use App::Codeowners::Util qw(stringf zip);
 use Color::ANSI::Util 0.03 qw(ansifg);
-use Encode qw(encode);
 
 sub stream {
     my $self    = shift;
@@ -34,7 +33,7 @@ sub stream {
     );
 
     my $text = stringf($self->format, %info);
-    print { $self->handle } encode('UTF-8', $text), "\n";
+    print { $self->handle } $text, "\n";
 }
 
 sub _expand_filter_args {
@@ -61,7 +60,7 @@ sub _colored {
     my $text = shift;
     my $rgb  = shift or return $text;
 
-    return $text if $ENV{NO_COLOR};
+    return $text if $ENV{NO_COLOR} || (defined $ENV{COLOR_DEPTH} && !$ENV{COLOR_DEPTH});
 
     $rgb =~ s/^(.)(.)(.)$/$1$1$2$2$3$3/;
     if ($rgb !~ m/^[0-9a-fA-F]{6}$/) {
This page took 0.022813 seconds and 4 git commands to generate.