[IPython-dev] Another unicode problem

Jörgen Stenarson jorgen.stenarson at bostream.nu
Wed Sep 19 13:58:03 EDT 2007


Ville M. Vainio skrev:
> On 9/18/07, Ville M. Vainio <vivainio at gmail.com> wrote:
>> Ok, I'll (try) to fix this today.
> 
>> On 9/17/07, Jörgen Stenarson <jorgen.stenarson at bostream.nu> wrote:
> 
>>> If I try to issue the magic command cd with a path containing swedish
>>> characters I get a UnicodeError.
> 
> This should be fixed now.
> 


There are still problems with unicode commandlines. I think it is 
related to the problem in ticket #129 which was fixed in r2168.

It seems that before calling compile a string needs to be encoded using
the correct encoding.

Below are the results with/without the attached patch.

The patch also changes the ctypes implementation of _set_term_title to 
work properly with these strings as well (at least on my machine).

Since I'm not sure about the patch, I'm not that familiar with this part 
  of the code, I did not just go ahead and check it in. There might be a 
better more correct way of doing it, there are possibly more places that 
should be fixed as well.


/Jörgen


c:\python\packages>ipython
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)]
Type "copyright", "credits" or "license" for more information.

IPython 0.8.2.svn.r2750 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object'. ?object also works, ?? prints more.

In [1]: cd åäö
[Errno 2] No such file or directory: '\xc3\xa5\xc3\xa4\xc3\xb6'
c:\python

In [2]:
Do you really want to exit ([y]/n)?



c:\python\packages>ipython
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)]
Type "copyright", "credits" or "license" for more information.

IPython 0.8.2.svn.r2750 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object'. ?object also works, ?? prints more.

In [1]: cd åäö
c:\python\packages\åäö

In [2]:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/applefile
Size: 1485 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20070919/15ad3e73/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cdmagic.patch
Type: application/octet-stream
Size: 1172 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20070919/15ad3e73/attachment.obj>


More information about the IPython-dev mailing list