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