On Thu, May 19, 2011 at 01:02:36PM -0700, Volker Braun wrote:
> Is there a consensus to not allow arbitrary unicode in command line output? 
> It seems like it might be useful, but apparently its technically not 
> supported. Is this a bug or a feature?
> 
> For the record, if your _repr_() method returns actual unicode then the 
> following happens:
>  
> ---------------------------------------------------------------------------
> UnicodeEncodeError                        Traceback (most recent call last)
> 
<snip>
> 
> UnicodeEncodeError: 'ascii' codec can't encode character u'\u2283' in 
> position 5: ordinal not in range(128)

That depends on your locale:

$ LANG=C ./sage -ipython -c "print u'\u2283'"
>print(u'\u2283')
---------------------------------------------------------------------------
UnicodeEncodeError                        Traceback (most recent call last)

/data/sage/sage-4.6.1.rc0/<ipython console> in <module>()

UnicodeEncodeError: 'ascii' codec can't encode character u'\u2283' in position 0
: ordinal not in range(128)


$ LANG=en_US.utf-8 ./sage -ipython -c "print u'\u2283'"
 
>print(u'\u2283')
(superset sign)


In general I'd say assuming less about the current locale is better.

-Willem Jan

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to