From 381c78bf71f07127341e539a4519831f75e2ca11 2007-04-02 05:35:16 From: fperez Date: 2007-04-02 05:35:16 Subject: [PATCH] - More unicode fixes, properly split user input without generating unicode-filled variables that will be treated as python identifiers. --- diff --git a/IPython/iplib.py b/IPython/iplib.py index deffb67..3e3ebef 100644 --- a/IPython/iplib.py +++ b/IPython/iplib.py @@ -6,7 +6,7 @@ Requires Python 2.3 or newer. This file contains all the classes and helper functions specific to IPython. -$Id: iplib.py 2190 2007-03-30 18:35:46Z fperez $ +$Id: iplib.py 2195 2007-04-02 05:35:16Z fperez $ """ #***************************************************************************** @@ -2045,6 +2045,14 @@ want to merge them back into the new files.""" % locals() else: pre,iFun,theRest = lsplit.groups() + # iFun has to be a valid python identifier, so it better be only pure + #ascii, no unicode: + try: + iFun = iFun.encode('ascii') + except UnicodeEncodeError: + theRest = iFun+u' '+theRest + iFun = u'' + #print 'line:<%s>' % line # dbg #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg return pre,iFun.strip(),theRest diff --git a/doc/ChangeLog b/doc/ChangeLog index c88159f..d3d0c69 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,10 @@ 2007-04-01 Fernando Perez + * IPython/iplib.py (split_user_input): ensure that when splitting + user input, the part that can be treated as a python name is pure + ascii (Python identifiers MUST be pure ascii). Part of the + ongoing Unicode support work. + * IPython/Prompts.py (prompt_specials_color): Add \N for the actual prompt number, without any coloring. This allows users to produce numbered prompts with their own colors. Added after a