Skip Menu |

This queue is for tickets about the Curses-UI CPAN distribution.

Report information
The Basics
Id: 56695
Status: open
Priority: 0/
Queue: Curses-UI

People
Owner: Nobody in particular
Requestors: tomas [...] mudrunka.cz
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Curses::UI Wide character support
Date: Sun, 18 Apr 2010 17:56:02 +0200
To: <mdxi [...] cpan.org>, <bug-curses-ui [...] rt.cpan.org>
From: Tomáš Mudruňka <tomas [...] mudrunka.cz>
Hello, few months ago i've filed this bug on CPAN: https://rt.cpan.org/Public/Bug/Display.html?id=54182 and today i filed similar one on google code: http://code.google.com/p/curses-ui/issues/detail?id=6 i've just wanted to ask if there will ever be wide character support in Curses::UI (which is IMHO most developer-friendly way to create cursed applications)... We'd like to use C::UI in our project but we need support for (English,) Czech and Slovak languages using UTF-8. Applications written in C (midnight-commander,vi,emacs,nano,links,...) are supporting our languages (and UTF-8) very well. I do not exactly know why PERL have such troubles with encodings, but i think there is way to handle that. Peace Harvie
RT-Send-CC: mdxi [...] cpan.org
Hello, I've fixed utf8 characters support for Curses::UI. Please look at my diff in attach. It was tested successfully for Russian (Cyrillic). After applying this patch you should specify '-utf8=>1' when create main Curses::UI object if you want to threat all non-ASCII symbols as symbols in utf8 encoding. Best regards, Dmytro Gorbunov
Subject: Curses-UI-0.9607.utf8fix.diff
diff -r Curses-UI-0.9607/examples/color_editor Curses-UI-0.9607.utf8fix/examples/color_editor 74c74,75 < -color_support => 1 --- > -color_support => 1, > -utf8 => 1 diff -r Curses-UI-0.9607/lib/Curses/UI/Common.pm Curses-UI-0.9607.utf8fix/lib/Curses/UI/Common.pm 434c434 < print STDERR "DEBUG: get_key() -> select() -> $!\n" --- > print STDERR "DEBUG: get_key() -> select() -> $!\n" 437c437,452 < $key = $s->getch(); --- > $key = $s->getch(); > > if ($Curses::UI::utf8) { > my $c = unpack("C", $key); > if ($c > 128){ # utf8 character is coming > my @char_utf8 = ($c); # contains bytes for one symbol in utf8 encoding > > # 6 byte is max for utf8 encoding > while (length ($key) <= 6 and !utf8::decode($key)) { > my $key_next = $s->getch(); > my $c_next = unpack("C",$key_next); > push @char_utf8, $c_next; > $key = pack("C*", @char_utf8); > } > } > } diff -r Curses-UI-0.9607/lib/Curses/UI/TextEditor.pm Curses-UI-0.9607.utf8fix/lib/Curses/UI/TextEditor.pm 336c336,337 < $xpos = length(substr($_, 0, ($this->{-pos}-$trackpos))); --- > #$xpos = length(substr($_, 0, ($this->{-pos}-$trackpos))); > $xpos = $this->{-pos}-$trackpos; diff -r Curses-UI-0.9607/lib/Curses/UI.pm Curses-UI-0.9607.utf8fix/lib/Curses/UI.pm 63a64 > $Curses::UI::utf8 = 0; 153a155 > -utf8 => 0, 175a178,180 > $Curses::UI::utf8 = $args{-utf8} > if defined $args{-utf8}; >
Subject: Re: [rt.cpan.org #56695] Curses::UI Wide character support
Date: Tue, 01 Feb 2011 02:48:42 +0100
To: <bug-Curses-UI [...] rt.cpan.org>
From: Tomáš Mudruňka <tomas [...] mudrunka.cz>
You are my hero :-) will this get into the official tree? BTW are there some reason to not enable this by default? THX!!!
Show quoted text
>You are my hero :-) will this get into the official tree?
Thanks for support! Hope it will be in official tree soon, it depends on current maintainer Shawn Boyette I guess. Show quoted text
>BTW are there some reason to not enable this by default?
Yes, users without utf-8 support in console(latin-1, cp866, etc) shouldn't switch this flag on, otherwise characters with codes 128-255 will be broken. Kind regards, Dmytro Gorbunov
Subject: Re: [rt.cpan.org #56695] Curses::UI Wide character support
Date: Tue, 01 Feb 2011 20:51:43 +0100
To: <bug-Curses-UI [...] rt.cpan.org>
From: Tomáš Mudruňka <tomas [...] mudrunka.cz>
BTW This will get to the ArchLinux community repository soon... (due to what package maintainer said)
Subject: [rt.cpan.org #56695] Curses::UI Wide character support
Date: Thu, 05 Dec 2013 15:19:33 +0100
To: <bug-Curses-UI [...] rt.cpan.org>
From: Christophe Ségui <christophe.segui [...] math.univ-toulouse.fr>
Hi, Thanks for this fix which works perfectly. When can we hope to see this patch included ? Thanks, Christophe
Subject: Curses::UI Wide character support [rt.cpan.org #56695]
Date: Tue, 8 Apr 2014 17:12:01 +0200
To: bug-Curses-UI [...] rt.cpan.org
From: Edgar Fuß <ef [...] math.uni-bonn.de>
The proposed patch looks like working around symptoms of Curses not using the wide-character curses functions and not caring about either Perl's utf8 flag or the current locale. The right way to deal with the problem should be fixing Curses (which I did) and change Curses::UI to use the new wide-character-aware getchar and addstring functions. If you use Curses 1.29 and simply s/getch/getchar/ and s/addstr/addstring/ in Curses-UI, everything woks fine regardlesss of your locale (provided your Curses links to a wide-character curses, e.g. ncursesw). Or so I believe.