Re: How to print a unicode string?

2008-04-18 Thread damonwischik
On Apr 19, 12:38 am, Damon Wischik wrote: > I'd like to print out a unicode string. > > I'm running Python inside Emacs, which understands utf-8, so I want to > force Python to send utf-8 to sys.stdout. Thank you everyone who was sent suggestions. Here is my solution (for making Python output utf-

Re: How to print a unicode string?

2008-04-18 Thread damonwischik
On Apr 19, 1:53 am, Ben Finney wrote: > Damon Wischik writes: >> Why does it matter what locales my OS supports, when all I want is >> to set the encoding to be used for the output > > Because the Python 'locale' module is all about using the OS's > (actually, the underlying C library's) locale sup

Re: How to print a unicode string?

2008-04-18 Thread damonwischik
On Apr 19, 1:14 am, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > From what I've googled, I think I need to set my locale. > > Not on this operating system. On Windows, you need to change > your console. If it is a cmd.exe-style console, use chcp. > For IDLE, changing the output encoding is not

Re: How to print a unicode string?

2008-04-18 Thread damonwischik
On Apr 19, 1:36 am, 7stud <[EMAIL PROTECTED]> wrote: > u_str = u'hell\u00F6 w\u00F6rld' #o's with umlauts > print u_str.encode('utf-8') > > --output:-- > hellö wörld Maybe on your system. On my system, those same commands produce hell\303\266 w\303\266rld Those \303\266 symbols are single charac

Re: How to print a unicode string?

2008-04-18 Thread damonwischik
On Apr 19, 12:51 am, Ben Finney wrote: > Just because the locale library knows the normalised name for it > doesn't mean it's available on your OS. Have you confirmed that your > OS (independent of Python) supports the locale you're trying to set? No. How do I found out which locales my OS support

How to print a unicode string?

2008-04-18 Thread damonwischik
I'd like to print out a unicode string. I'm running Python inside Emacs, which understands utf-8, so I want to force Python to send utf-8 to sys.stdout. >From what I've googled, I think I need to set my locale. I don't understand how. import locale print locale.getlocale() --> (None,None) print

Set sys.stdout.encoding to utf8 in emacs/python-mode?

2008-03-27 Thread damonwischik
I use emacs 22 and python-mode. Emacs can display utf8 characters (e.g. when I open a utf8-encoded file with Chinese, those characters show up fine), and I'd like to see utf8-encoded output from my python session. >From googling, I've found references to * locale.getdefaultlocale(), which is ('en_

Stealing focus: PIL

2005-11-25 Thread damonwischik
I'm using the Python Image Library (PIL) for Python 2.4. If I have an image and I show it from PIL import Image im = Image.new('RGB',100,100) im.show() then the output window steals focus. It's very handy to use an image to show the progress of execution for my program, but the computer is u

Stealing focus: emacs, and PIL, in Windows

2005-11-25 Thread damonwischik
I'm using GNU Emacs 21.3.1 with python-mode 1.0alpha under Windows XP. Whenever I execute a command in an edit window (with py-execute-region), the output window steals the focus. How can I stop this happening? I don't know any lisp, but I hacked together this routine so that that when I press ctr