We might be able to hack around this is the displayhook, but I'd rather 
not. It just is how Python 2.x works. Switching to Python 3 is the proper 
fix for this issue.


On Tuesday, April 28, 2015 at 3:54:27 PM UTC-4, Nils Bruin wrote:
>
> On Tuesday, April 28, 2015 at 10:50:26 AM UTC-7, [email protected] wrote:
>>
>> On sagenb worksheet, Sage version 6.6 
>>
>> print "Direct translation of 'Mäntysalo' is 'Pine forest'." 
>>
>> works as expected, but 
>>
>> x="Direct translation of 'Mäntysalo' is 'Pine forest'"; x 
>>
>> outputs 
>>
>> "Direct translation of 'M\xc3\xa4ntysalo' is 'Pine forest'" 
>>
>
> The difference is probably due to:
>
> sage: print x
> Direct translation of 'Mäntysalo' is 'Pine forest'
> sage: print repr(x)
> "Direct translation of 'M\xc3\xa4ntysalo' is 'Pine forest'"
>
> The standard printing of results is via "repr", which escapes special 
> characters, in order to produce a string that can be entered into python 
> again:
>
> sage: print repr(repr(x))
> '"Direct translation of \'M\\xc3\\xa4ntysalo\' is \'Pine forest\'"'
>
> Unfortunately, it seems that "repr" on strings also escapes non-ascii 
> unicode sequences that are perfectly fine to enter directly on a 
> unicode-aware input device. That's probably the place to look if you want 
> to change it somewhere.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to