John Hunter wrote:
> On 3/17/07, Eric Firing <[EMAIL PROTECTED]> wrote:
>> In response to the feature request:
>>
>> Does anyone see any disadvantage to making Text.__init__ and
>> Text.set_text() either try to call the __str__ method, or use the str()
>> builtin, if passed an argument that is not a string?  Maybe there is no
>> need to even check--just automatically use str(arg)?  Offhand, this
>> looks to me like it would provide a gain in convenience and
>> intuitiveness with no pain.
> 
> My concern is that we don't break unicode support , so if you come up
> with a solution that supports calling str but doesn't break unicode,
> it's fine by me
> 
> 
> In [2]: x = unicode('D\351velopp\351s et fabriqu\351s', 'latin-1')
> 
> In [3]: x
> Out[3]: u'D\xe9velopp\xe9s et fabriqu\xe9s'

Looks like the simplest thing is

arg = '%s' % (arg,)

I'll give that a try.

Eric


> 
> In [4]: str(x)
> ---------------------------------------------------------------------------
> exceptions.UnicodeEncodeError                        Traceback (most
> recent call last)
> 
> /Users/jdhunter/<ipython console>
> 
> UnicodeEncodeError: 'ascii' codec can't encode character '\ue9' in
> position 1: ordinal not in range(128)


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to