#13296: matplotlib do not handle unicode properly from command line
---------------------------------------+------------------------------------
Reporter: slabbe | Owner: jason, was
Type: defect | Status: new
Priority: major | Milestone: sage-5.3
Component: graphics | Resolution:
Keywords: unicode, matplotlib | Work issues:
Report Upstream: N/A | Reviewers:
Authors: | Merged in:
Dependencies: | Stopgaps:
---------------------------------------+------------------------------------
Comment (by jhpalmieri):
> So now, we need to understand how to put the string -*- coding: utf-8
-*- somewhere for the commande line?
I'm not sure this is a good idea: we shouldn't change Python's default
behavior without a really good reason. If you want to use accents in a
Python string, then I think you need to specify the encoding explicitly
(see http://docs.python.org/howto/unicode.html, in particular
[http://docs.python.org/howto/unicode.html#unicode-literals-in-python-
source-code this section]). So you should do
{{{
sage: text(unicode('an accent : é', encoding='utf-8'), (1,1), color='red')
}}}
This command works for me. Indeed,
{{{
sage: s = unicode('an accent : é', encoding='utf-8')
sage: ss = u'an accent : é'
sage: s == ss
False
}}}
and I think that the `s` version is the right way to do it. Alternatively,
you can use unicode escape sequences, as in
{{{
text(u'an accent : \xe9', (1,1), color='red')
}}}
I'm not at all a unicode expert, though.
Anyway, I suggest instead adding some documentation. See the attached
patch.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13296#comment:10>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.