[IPython-user] IPython Color help on windows cmd shell

Thomas Heller theller@ctypes....
Fri Mar 2 02:48:25 CST 2007


Robert Kern schrieb:
> Fernando Perez wrote:
>> On 3/2/07, Thomas Heller <theller@ctypes.org> wrote:
> 
>>> In [1]: class X(object):
>>>    ...:     u"the doc string"
>>>    ...:
>>>    ...:
>>>
>>> In [2]: x = X()
>>>
>>> In [3]: x??
>>> T y p eX B a s e   C < c l a s s   ' _ _ mS t r i n g    < _ _ m a i n _ _ . X   o b j e cN a m e s pI n t e r a D o c s
>>>  t r i n g   [ s o u r c e   f        t h e   d o
>> 
>> Mmh, very odd.  I don't see that at all under Linux:
> 
>> I know so little about windows that I honestly don't have a clue as to
>> what the problem could be.  Any suggestions?
> 
> Various (GUI terminal, font) combinations, on all platforms, want to render
> "Unicode" characters as double-width.
> 
Yes, and pyreadline/console.py should convert unicode to byte strings before
rendering them.  There are two possibilities to fix this with ctypes:
- The first one is to explicitely convert unicode strings.  The attached patch
  does that for the WriteConsoleA function.

- The second one is to let ctypes do it automatically by setting the .argtypes
  attribute on the functions that need to handle text; in this case ctypes
  automatically convert unicode/byte strings.

Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: console.diff
Type: text/x-patch
Size: 1529 bytes
Desc: not available
Url : http://lists.ipython.scipy.org/pipermail/ipython-user/attachments/20070302/55af2cc4/attachment.bin 


More information about the IPython-user mailing list