texts & encoding

Hi,

I'm new to matplotlib which is really good job :wink: and I'm currently
fighting against character encodings :-(.
Being working under win2k/western Europe, I finally found on the web
that using a cp850 source encoding definition was working with 'print'
only if you also encode your strings from cp1252! (for us/en users:
windows uses cp1252 but the console uses cp850, this message was written
using iso-8859-1).
Example:

# -*- coding: cp850 -*-
print unicode('texte fran�ais','cp1252')

texte fran�ais

If I do the same with the matplotlib 0.54 'title' function I get an error telling the 'ascii' codec cannot encode my '�':

# -*- coding: cp850 -*-
from matplotlib.matlab import *
plot([1,2,3,4])
title(unicode('texte fran�ais','cp1252'))

Exception in tkinter callback

Traceback ...
[...]
font.set_text(s, 0.0) # ...
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe7' in
position 10: ordinal not in range(128)

···

-----------------

With matplotlib 0.61 I get this error:

>>> title(unicode('texte fran�ais','cp1252'))
Traceback (most recent call last):
   File "<<console>>", line 1, in ?
   File "C:\PYTHON23\Lib\site-packages\matplotlib\matlab.py", line 1576, in title
     draw_if_interactive()
   File "C:\PYTHON23\Lib\site-packages\matplotlib\backends\backend_gtk.py", line 582, in draw_if_interactive
     figManager.canvas.draw()
   File "C:\PYTHON23\Lib\site-packages\matplotlib\backends\backend_gtkagg.py", line 40, in draw
     FigureCanvasAgg.draw(self)
   File "C:\PYTHON23\Lib\site-packages\matplotlib\backends\backend_agg.py", line 306, in draw
     self.figure.draw(self.renderer)
   File "C:\PYTHON23\Lib\site-packages\matplotlib\figure.py", line 236, in draw
     for a in self.axes: a.draw(renderer)
   File "C:\PYTHON23\Lib\site-packages\matplotlib\axes.py", line 704, in draw
     self._title.draw(renderer)
   File "C:\PYTHON23\Lib\site-packages\matplotlib\text.py", line 209, in draw
     bbox, info = self._get_layout(renderer)
   File "C:\PYTHON23\Lib\site-packages\matplotlib\text.py", line 108, in _get_layout
     w,h = renderer.get_text_width_height(
   File "C:\PYTHON23\Lib\site-packages\matplotlib\backends\backend_agg.py", line 210, in get_text_width_height
     font.set_text(s, 0.0) # the width and height of unrotated string
TypeError: CXX: type error.

---------------

I tried to add different encodings (ie. unicode('texte fran�ais',
'cp1252').encode(...) with utf-8, cp1252, cp850...) without success.
Naturally if I omit any unicode translation, it does not crash but the
string is not correctly rendered. Does it mean that matplotlib currently
expects 'ascii' strings only to passed to its text functions?

JM. Philippe