Thank you, this is most helpful, and i will heed your advice about the cast.
Cheers! Ulrich Eckhardt wrote: > > On Wednesday 25 February 2009, Heracles wrote: >> addchstr((chtype*)PyString_AsString(pS)) > > You are effectively disabling the well-deserved warnings with the cast > here. > Don't do that. > >> Now the thing is that when I make calls from python like so: >> >> curses.addchstr(5,10, "@ < Row 5, Col 10") > [...] >> What prints out on the screen is gobledygook not the strings you would >> expect below. > [...] >> Any thoughts on how to correctly convert the PyStringObject arguments to >> chtype* pointers so that the ncurses library will be able to understand >> them? > > In this case, I suggest man ncurses: > > | cchar_t > | corresponds to chtype. However it is a structure, because more > | data is stored than can fit into an integer. The characters are > | large enough to require a full integer value - and there may > | be more than one character per cell. The video attributes and > | color are stored in separate fields of the structure. > > I'm pretty sure that you can find functions to generate such a string both > from a char-string (with whatever encoding) or a wchar_t-string (using > Unicode probably) in the curses library. > > Uli > > -- > Sator Laser GmbH > Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 > > ************************************************************************************** > Sator Laser GmbH, Fangdieckstraße 75a, 22547 Hamburg, Deutschland > Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 > ************************************************************************************** > Visit our website at <http://www.satorlaser.de/> > ************************************************************************************** > Diese E-Mail einschließlich sämtlicher Anhänge ist nur für den Adressaten > bestimmt und kann vertrauliche Informationen enthalten. Bitte > benachrichtigen Sie den Absender umgehend, falls Sie nicht der > beabsichtigte Empfänger sein sollten. Die E-Mail ist in diesem Fall zu > löschen und darf weder gelesen, weitergeleitet, veröffentlicht oder > anderweitig benutzt werden. > E-Mails können durch Dritte gelesen werden und Viren sowie > nichtautorisierte Änderungen enthalten. Sator Laser GmbH ist für diese > Folgen nicht verantwortlich. > ************************************************************************************** > > _______________________________________________ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/lists%40nabble.com > > -- View this message in context: http://www.nabble.com/String-conversion-issues-implementing-new-curses-module-method-addchstr%2C-etc.-tp22211983p22225142.html Sent from the Python - python-dev mailing list archive at Nabble.com. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com