[IPython-dev] String encoding

Thomas Kluyver takowl@gmail....
Fri Jun 17 05:24:11 CDT 2011


On 17 June 2011 07:39, Fernando Perez <fperez.net@gmail.com> wrote:

> I guess we could make it a configurable option, but I'm not even sure
> it's worth the added complexity, so I'm mildly -1 on going down that
> road, unless I can be convinced that the implementation isn't that
> complicated and that there's really a *major* usability win for
> certain users for whom the default is just too annoying to bear.
>

The complexity in terms of code is fairly minimal - a boolean config
variable, and an if/else inside run_cell should cover it. The main downside
would be the added load on testing and maintenance - if the variable became
widely used, any bug report relating to unicode would leave us asking which
way the user had it set.

I'll leave it to Jörgen to put the case for usability.

In fact, I've just worked out a way round the issue, although it's not
pretty. If we were to encode each cell, and prepend the "# coding: <enc>"
magic comment before parsing it, it seems to work. However, the line numbers
within the cell are then out by 1 (i.e. if you see a traceback). As far as I
can tell, there's no way to store this state between compile/parse calls -
codeop.Compile doesn't remember it. I don't much like the idea of doing
this, though.

Thanks,
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-dev/attachments/20110617/0a17452d/attachment.html 


More information about the IPython-dev mailing list