[yast-devel] unicode strings in ncurses gui with libyui
Hi! I wonder how i can get special characters "äöü" to be displayed in the ncurses gui. I use python-yui (libyui-bindings for python). An example is attached. The "äüö" works for QT UI, but not for ncurses. Any hint in the right direction ?! Best regards Jan-Simon
* Jan-Simon Möller <dl9pf@gmx.de> [Jul 29. 2008 13:39]:
Hi!
I wonder how i can get special characters "äöü" to be displayed in the ncurses gui. I use python-yui (libyui-bindings for python). An example is attached.
The "äüö" works for QT UI, but not for ncurses.
This is going to be ugly ... Doing a 'full debug' run, YNCurses reports the following: <_M_> [ncurses] YNCursesUI.cc:59 YNCursesUI(): Start YNCursesUI <_M_> [ncurses] YNCursesUI.cc:75 YNCursesUI(): setenv LC_CTYPE: C encoding: ANSI_X3.4-1968 <_M_> [ncurses] NCstring.cc:325 setTerminalEncoding(): Terminal encoding SET to: ANSI_X3.4-1968 <dbg> [ncurses] NCApplication.cc:56 setLanguage(): Language: de_DE.UTF-8 Encoding: ANSI_X3.4-1968 $LANG, $LC_CTYPE and $LC_ALL report "de_DE.UTF-8". Still, YNCurses sets the encoding to "ANSI_X3.4-1968" Even doing an explict setConsoleFont("(K", "lat9w-16.psfu", "trivial", "", "en_US.UTF-8") doesn't help since 'setfont' cannot open the pty. Further down the debug log one finds the following <dbg> [ncurses] NCstring.cc:144 RecodeFromWchar(): iconv_open( UTF-8, "WCHAR_T" ) <dbg> [ncurses] NCstring.cc:144 RecodeFromWchar(): Hello,Wörld! Longest line: 10 So *apparently* the string is read correctly. However, a few more lines down: <dbg> [ncurses] NCstring.cc:144 RecodeFromWchar(): iconv_open( ANSI_X3.4-1968, "WCHAR_T" ) <ERR> [ncurses] NCstring.cc:187 RecodeFromWchar(): ERROR iconv: 84 Now I'm clueless. Any ncurses / console experts out there ? Klaus -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
On Tue, Jul 29, Klaus Kaempf wrote:
* Jan-Simon M?ler <dl9pf@gmx.de> [Jul 29. 2008 13:39]:
Hi!
I wonder how i can get special characters "?? to be displayed in the ncurses gui. I use python-yui (libyui-bindings for python). An example is attached.
The "?? works for QT UI, but not for ncurses.
This is going to be ugly ...
Doing a 'full debug' run, YNCurses reports the following:
<_M_> [ncurses] YNCursesUI.cc:59 YNCursesUI(): Start YNCursesUI <_M_> [ncurses] YNCursesUI.cc:75 YNCursesUI(): setenv LC_CTYPE: C encoding: ANSI_X3.4-1968 <_M_> [ncurses] NCstring.cc:325 setTerminalEncoding(): Terminal encoding SET to: ANSI_X3.4-1968 <dbg> [ncurses] NCApplication.cc:56 setLanguage(): Language: de_DE.UTF-8 Encoding: ANSI_X3.4-1968
$LANG, $LC_CTYPE and $LC_ALL report "de_DE.UTF-8". Still, YNCurses sets the encoding to "ANSI_X3.4-1968"
Well, the log says 'LC_CTYPE: C' Don't get confused by 'setenv LC_CTYPE: C', ncurses retrieves the value by calling setlocale( LC_CTYPE, NULL ); and then explicitly sets $LC_CTYPE. And the encodig is also based on LC_CTYPE via 'nl_langinfo(CODESET)' I'd say your LC_CTYPE is C and not de_DE.UTF-8. -- cu, Michael Andres +------------------------------------------------------------------+ Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4 +------------------------------------------------------------------+ Michael Andres YaST Development ma@novell.com SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg) Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 740 53-0 +------------------------------------------------------------------+ -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
* Michael Andres <ma@suse.de> [Jul 29. 2008 21:14]:
Well, the log says 'LC_CTYPE: C'
Good catch !
Don't get confused by 'setenv LC_CTYPE: C', ncurses retrieves the value by calling
setlocale( LC_CTYPE, NULL );
and then explicitly sets $LC_CTYPE.
So it _sets_ LC_CTYPE ? Based on what ?
And the encodig is also based on LC_CTYPE via 'nl_langinfo(CODESET)'
I'd say your LC_CTYPE is C and not de_DE.UTF-8.
Now how do I fix this ? Klaus -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
On Wed, Jul 30, Klaus Kaempf wrote:
* Michael Andres <ma@suse.de> [Jul 29. 2008 21:14]:
Well, the log says 'LC_CTYPE: C'
Good catch !
Don't get confused by 'setenv LC_CTYPE: C', ncurses retrieves the value by calling
setlocale( LC_CTYPE, NULL );
and then explicitly sets $LC_CTYPE.
So it _sets_ LC_CTYPE ? Based on what ?
The result of setlocale( LC_CTYPE, NULL ). This queries for the LC_CTYPE in effect.
Now how do I fix this ?
I suppose either you LC_ALL or LC_CTYPE is set to C, and needs to be unset. -- cu, Michael Andres +------------------------------------------------------------------+ Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4 +------------------------------------------------------------------+ Michael Andres YaST Development ma@novell.com SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg) Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 740 53-0 +------------------------------------------------------------------+ -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
* Michael Andres <ma@suse.de> [Jul 30. 2008 15:55]:
Now how do I fix this ?
I suppose either you LC_ALL or LC_CTYPE is set to C, and needs to be unset.
This was the right trigger. Michael and I figured it out now. The final hint was in YNCursesUI.cc, line 67, which reads // setlocale ( LC_ALL, "" ) is called in WMFInterpreter::WFMInterpreter So adding import locale locale.setlocale(locale.LC_ALL, "") to the Python code fixed this for ncurses ! Klaus --- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
So adding
import locale locale.setlocale(locale.LC_ALL, "")
to the Python code fixed this for ncurses !
You saved my day ;) Thanks, Michael & Klaus! Best regards Jan-Simon -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
participants (3)
-
Jan-Simon Möller
-
Klaus Kaempf
-
Michael Andres