summaryrefslogtreecommitdiff
blob: accce925e039657617fb2fba1cd39f47c4c386f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From d70ba71c7a0173991cddf9a43b4855864294c203 Mon Sep 17 00:00:00 2001
From: Slaven Rezic <slaven@rezic.de>
Date: Fri, 12 Feb 2010 21:47:01 +0100
Subject: [PATCH] added support for non-iso8859-1 terminals, see
 https://rt.cpan.org/Public/Bug/Display.html?id=35543

---
 leo |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/leo b/leo
index f734249..e65c1b1 100755
--- a/leo
+++ b/leo
@@ -58,6 +58,8 @@ sub debug;
 
 my($o_s, $o_m, $o_c, $o_l, $o_v, $o_h, $o_n, $o_f, $o_d, $o_u, $o_p);
 
+isatty(1) && eval q{ use open OUT => ':locale'};
+
 #
 # commandline options
 #
@@ -95,6 +97,14 @@ if (!$string) {
   $string = <STDIN>;
   chomp $string;
 }
+if (eval { require I18N::Langinfo; require Encode; 1 }) {
+  my $codeset = I18N::Langinfo::langinfo(I18N::Langinfo::CODESET());
+  if ($codeset) {
+    for ($string) {
+      $_ = Encode::decode($codeset, $_);
+    }
+  }
+}
 
 #
 # open the config, if any
-- 
1.6.4.3