f7d2db4
Description: utf8 support in input, output and arguments on utf8-enabled locales
f7d2db4
 Note that this is not a complete solution (doesn't support Chinese/Japanese
f7d2db4
 characters for example) but it's better than what we had.
f7d2db4
Origin: vendor, http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=254557#27
f7d2db4
Bug-Debian: http://bugs.debian.org/254557
f7d2db4
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/cowsay/+bug/393212
f7d2db4
Author: Damyan Ivanov <dmn@debian.org>
f7d2db4
f7d2db4
--- a/cowsay
f7d2db4
+++ b/cowsay
f7d2db4
@@ -12,6 +12,13 @@ use File::Basename;
f7d2db4
 use Getopt::Std;
f7d2db4
 use Cwd;
f7d2db4
 
f7d2db4
+if (${^UTF8LOCALE}) {
f7d2db4
+    binmode STDIN, ':utf8';
f7d2db4
+    binmode STDOUT, ':utf8';
f7d2db4
+    require Encode;
f7d2db4
+    eval { $_ = Encode::decode_utf8($_,1) } for @ARGV;
f7d2db4
+}
f7d2db4
+
f7d2db4
 $version = "3.03";
f7d2db4
 $progname = basename($0);
f7d2db4
 $eyes = "oo";