Skip Menu |

This queue is for tickets about the WWW-Dict-Leo-Org CPAN distribution.

Report information
The Basics
Id: 35543
Status: resolved
Priority: 0/
Queue: WWW-Dict-Leo-Org

People
Owner: tlinden [...] cpan.org
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in:
  • 1.34
  • 1.35
Fixed in: (no value)



Subject: leo script and utf8 terminals
The leo script does not work very well with utf8-enabled terminals i.e. umlauts are usually not displayed in the result. I think the easiest way to fix this is to add use open OUT => ':locale'; on top of the leo script, which would set the encoding of STDIN and STDOUT to the charset of the current encoding. open.pm is (according to Module::CoreList) available for perl 5.6 and newer. For older perls you should probably disable the usage of open.pm. It seems that input encoding currently works, that is I can specify search terms with umlauts per command line or using <STDIN> and both methods are already working. Regards, Slaven
On Wed Apr 30 06:00:24 2008, SREZIC wrote: Show quoted text
> The leo script does not work very well with utf8-enabled terminals i.e. > umlauts are usually not displayed in the result. I think the easiest way > to fix this is to add > > use open OUT => ':locale'; > > on top of the leo script, which would set the encoding of STDIN and > STDOUT to the charset of the current encoding. open.pm is (according to > Module::CoreList) available for perl 5.6 and newer. For older perls you > should probably disable the usage of open.pm. > > It seems that input encoding currently works, that is I can specify > search terms with umlauts per command line or using <STDIN> and both > methods are already working.
Attached a patch which tries to solve this problem. Works for me with a iso-8859-1 and utf-8 terminal. Regards, Slaven
Subject: 0001-added-support-for-non-iso8859-1-terminals-see.patch
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
Patch is now available from CPAN (so it may be referenced in distroprefs files): http://cpan.cpantesters.org/authors/id/S/SR/SREZIC/patches/WWW-Dict-Leo-Org-1.35-RT35543.patch Regards, Slaven
Fixed in 1.36. Thanks for the patch!