Ian Ward | 7 Feb 2006 14:30
Favicon
Gravatar

Problem with curses and UTF-8

When I run the following code in a terminal with the encoding set to 
UTF-8 I get garbage on the first line, but the correct output on the second.

import curses
s = curses.initscr()
s.addstr('\xc3\x85 U+00C5 LATIN CAPITAL LETTER A WITH RING ABOVE\n')
s.addstr('\xc3\xa5 U+00F5 LATIN SMALL LETTER O WITH TILDE')
s.refresh()
s.getstr()
curses.endwin()

I tested with gnome-terminal, Python 2.4 and Ubuntu breezy.  The output 
is correct when I run the following code:

print '\xc3\x85 U+00C5 LATIN CAPITAL LETTER A WITH RING ABOVE'
print '\xc3\xa5 U+00F5 LATIN SMALL LETTER O WITH TILDE'

Any Ideas?

Ian Ward

Ian Ward | 8 Feb 2006 00:26
Favicon
Gravatar

Replacing curses (Was: Re: Problem with curses and UTF-8)

Martin v. L?wis wrote:

>Ian Ward wrote:
>  
>
>>Any Ideas?
>>    
>>
>
>I think there is one or more ncurses bugs somewhere.
>
>The ncurses documentation suggests that you should link with
>ncurses_w instead of linking with ncurses - you might try
>that as well. If it helps, please do report back.
>
>Ultimately, somebody will need to debug ncurses to find out
>what precisely happens, and why.
>  
>
Thank you for your response. I see there are other people that have run 
into the same problem.

I've had to work around many curses issues while developing Urwid (a 
console UI library). Even if the bugs are fixed I'm going to have to 
bypass the curses module to support UTF-8 in a reliable way for all users.

I think there are enough escape sequences common to all modern terminals 
so that I can build a generic curses-replacement for my library. 
However, if someone is already working on something similar I don't want 
to reinvent the wheel.
(Continue reading)

Ian Ward | 8 Feb 2006 11:46
Favicon
Gravatar

ANN: Urwid 0.9.0-pre1 curses-based UI library

Announcing Urwid 0.9.0-pre1
---------------------------

Urwid home page:
   http://excess.org/urwid/

Tarball:
   http://excess.org/urwid/urwid-0.9.0-pre1.tar.gz

About this release:
===================

This is a development release intended only for those interested in working
with the new Layout classes and those who want to help improve UTF-8 
support.

New in this release:
====================

   - New support for UTF-8 encoding.  Unicode strings may be used and 
will be
     converted to the current encoding when output.  Regular strings in the
     current encoding may still be used.

     PLEASE NOTE: There are issues related to displaying UTF-8 characters
     with the curses_display module that have not yet been resolved.

   - New set_encoding(..) function replaces 
util.set_double_byte_encoding(..).

(Continue reading)

Ian Ward | 10 Feb 2006 17:31
Favicon
Gravatar

ANN: Urwid 0.9.0-pre2 curses-based UI library

Announcing Urwid 0.9.0-pre2
---------------------------

Urwid home page:
   http://excess.org/urwid/

Tarball:
   http://excess.org/urwid/urwid-0.9.0-pre2.tar.gz

About this release:
===================

This is a development release intended only for those interested in
working with the new Layout classes and those who want to help improve
UTF-8 support.

This release fixes a few problems introduced in -pre1.

New in this release:
====================

   - Replaced the custom align and wrap modes in example program calc.py
     with a new layout class.

   - Fixed Overlay class call to canvas.overlay broken by -pre1 changes.

   - Fixed Padding bug related to canvas -pre1 changes.

About Urwid
===========
(Continue reading)

Ilpo Nyyssönen | 12 Feb 2006 02:32
Picon
Picon
Favicon

ANN: Urwid 0.9.0-pre2 curses-based UI library

Ian Ward <ian <at> excess.org> writes:

> This is a development release intended only for those interested in
> working with the new Layout classes and those who want to help improve
> UTF-8 support.

Just sending a note as I did express some interest on helping with it. 
I moved to a bit bigger apartment few days ago and so I have been and
will be a while a bit busy. 

I'll take a look when I find the time.

--

-- 
Ilpo Nyyss?nen # biny # /* :-) */

Ian Ward | 13 Feb 2006 05:55
Favicon
Gravatar

ANN: Urwid 0.9.0-pre2 curses-based UI library

Ilpo Nyyss?nen wrote:

>Ian Ward <ian <at> excess.org> writes:
>
>  
>
>>This is a development release intended only for those interested in
>>working with the new Layout classes and those who want to help improve
>>UTF-8 support.
>>    
>>
>
>Just sending a note as I did express some interest on helping with it. 
>I moved to a bit bigger apartment few days ago and so I have been and
>will be a while a bit busy. 
>
>I'll take a look when I find the time.
>  
>
No worries,

UTF-8 outupt doesn't work with the curses library linked to most 
versions of python, so I'm writing a "raw_display" module that bypasses 
the curses library.. I've almost got it working and I'll release it soon.

Ian

Ian Ward | 14 Feb 2006 05:29
Favicon
Gravatar

ANN: Urwid 0.9.0-pre3 curses-based UI library

Announcing Urwid 0.9.0-pre3
---------------------------

Urwid home page:
   http://excess.org/urwid/

Tarball:
   http://excess.org/urwid/urwid-0.9.0-pre3.tar.gz

About this release:
===================

This is a development release intended only for those interested in
working with the new Layout classes and those who want to help improve
UTF-8 support.

This is a single bugfix release preceeding some major changes.

New in this release:
====================

   - Fixed Canvas attribute padding bug related to -pre1 changes.

About Urwid
===========

Urwid is a curses-based UI library for Python. It features fluid
interface resizing, CJK support, multiple text layouts, simple
attribute markup, powerful scrolling list boxes, flexible edit boxes
and HTML screen shots.
(Continue reading)

James Mills | 19 Feb 2006 06:59
Picon
Favicon
Gravatar

Example Applications

Hi All,

Other than speedomter.py, are there any other example
applications out there using urwid ?

cheers
James

--

-- 
--
-"Problems are Solved by Method"
-
- James Mills <prologic <at> shortcircuit.net.au>
- HomePage: http://shortcircuit.net.au/~prologic/
- Phone: +61732166379
- Mobile: +61404270962
- Skype: therealprologic
- MSN: prologic <at> shortcircuit.net.au
- ICQ: 98888663
- IRC: irc://shortcircuit.net.au#se

Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

Ian Ward | 19 Feb 2006 11:51
Favicon
Gravatar

Example Applications

James Mills wrote:

>Hi All,
>
>Other than speedomter.py, are there any other example
>applications out there using urwid ?
>  
>
I'm aware of a few:
- a Lyntin MUD client plugin called "Urwidui" by David Clymer
http://source.zettazebra.com/projects/hgwebdir.cgi
(under Lyntin click inventory, lyntin, ui, and download urwidui.py)

- part of the development environment of a game called "Thousand Parsec"
http://www.thousandparsec.net

- a USB Missile Launcher control program called "pymissile" by Scott Weston
http://scott.weston.id.au/software/pymissile-20060126/

I hope the example programs I've included with Urwid give a good idea of 
how to use the library as well.

Ian

Ian Ward | 20 Feb 2006 15:04
Favicon
Gravatar

ANN: Urwid 0.9.0 - Console UI library

Announcing Urwid 0.9.0
----------------------

Urwid home page:
  http://excess.org/urwid/

Tarball:
  http://excess.org/urwid/urwid-0.9.0.tar.gz

Screenshots:
  http://excess.org/urwid/utf8examples.html

About this release:
===================

This is the first release of Urwid with UTF-8 input and display support.
A new raw_display module was added to enable UTF-8 display.  This module
also fixes the "dead corner" in the bottom right of the screen and
improves legibility of bright text in some terminals.

New in this release:
====================

  - New support for UTF-8 encoding including input, display and editing
    of narrow and wide (CJK) characters.

    Preliminary combining (zero-width) character support is included,
    but full support will require terminal behavior detection.

    Right-to-Left input and display are not implemented.
(Continue reading)


Gmane